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

This commit is contained in:
Louis Knight-Webb
2026-01-16 08:33:16 +00:00
committed by GitHub
parent 010b03aafd
commit 0d6f51265b
2 changed files with 19 additions and 6 deletions

View File

@@ -193,9 +193,8 @@ export const useJsonPatchWsStream = <T extends object>(
retryTimerRef.current = null;
}
finishedRef.current = false;
dataRef.current = undefined;
setData(undefined);
setIsInitialized(false);
// Preserve data during reconnection attempts - only clear on unmount/disable
// Data will be refreshed when the new connection receives its initial snapshot
};
}, [
endpoint,
@@ -206,5 +205,14 @@ export const useJsonPatchWsStream = <T extends object>(
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 };
};

View File

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