Revert "don't hide tasks if streams fail (#2053)"

This reverts commit 0d6f51265b.
This commit is contained in:
Louis Knight-Webb
2026-01-17 09:40:24 +00:00
parent 4ffd7c92b9
commit f2fdeb13fe
2 changed files with 6 additions and 19 deletions

View File

@@ -193,8 +193,9 @@ export const useJsonPatchWsStream = <T extends object>(
retryTimerRef.current = null; retryTimerRef.current = null;
} }
finishedRef.current = false; finishedRef.current = false;
// Preserve data during reconnection attempts - only clear on unmount/disable dataRef.current = undefined;
// Data will be refreshed when the new connection receives its initial snapshot setData(undefined);
setIsInitialized(false);
}; };
}, [ }, [
endpoint, endpoint,
@@ -205,14 +206,5 @@ export const useJsonPatchWsStream = <T extends object>(
retryNonce, retryNonce,
]); ]);
// Clear data when the stream is disabled (separate effect to avoid clearing on reconnect)
useEffect(() => {
if (!enabled) {
dataRef.current = undefined;
setData(undefined);
setIsInitialized(false);
}
}, [enabled]);
return { data, isConnected, isInitialized, error }; return { data, isConnected, isInitialized, error };
}; };

View File

@@ -152,7 +152,6 @@ export function ProjectTasks() {
const { const {
projectId, projectId,
project,
isLoading: projectLoading, isLoading: projectLoading,
error: projectError, error: projectError,
} = useProject(); } = useProject();
@@ -846,8 +845,7 @@ export function ProjectTasks() {
const isInitialTasksLoad = isLoading && tasks.length === 0; const isInitialTasksLoad = isLoading && tasks.length === 0;
// Only show full-page error if we have no project data at all if (projectError) {
if (projectError && !project) {
return ( return (
<div className="p-4"> <div className="p-4">
<Alert> <Alert>
@@ -1087,18 +1085,15 @@ export function ProjectTasks() {
</GitOperationsProvider> </GitOperationsProvider>
); );
const connectionError =
streamError || (projectError && project ? projectError.message : null);
return ( return (
<div className="h-full flex flex-col"> <div className="h-full flex flex-col">
{connectionError && ( {streamError && (
<Alert className="w-full z-30 xl:sticky xl:top-0"> <Alert className="w-full z-30 xl:sticky xl:top-0">
<AlertTitle className="flex items-center gap-2"> <AlertTitle className="flex items-center gap-2">
<AlertTriangle size="16" /> <AlertTriangle size="16" />
{t('common:states.reconnecting')} {t('common:states.reconnecting')}
</AlertTitle> </AlertTitle>
<AlertDescription>{connectionError}</AlertDescription> <AlertDescription>{streamError}</AlertDescription>
</Alert> </Alert>
)} )}