Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions frontend/src/pages/DataCleansing/Detail/components/LogsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ export default function LogsTable({
startStreaming();
} else {
stopStreaming();
fetchTaskLog(selectedLog - 1);
fetchTaskLog(selectedLog - 1).then(() => {
// Static logs loaded, safe to clear streaming logs now
setStreamingLogs([]);
});
}
return () => stopStreaming();
}, [id, selectedLog, retryCount, shouldStream]);
Expand All @@ -63,7 +66,11 @@ export default function LogsTable({
const logEntry: LogEntry = JSON.parse(event.data);
if (logEntry.message === "[END_OF_STREAM]" || logEntry.message === "[HEARTBEAT]") {
if (logEntry.message === "[END_OF_STREAM]") {
stopStreaming();
// Don't clear streamingLogs immediately - keep them visible
// while the static fetch completes
eventSourceRef.current?.close();
eventSourceRef.current = null;
setIsStreaming(false);
}
return;
}
Expand All @@ -88,7 +95,10 @@ export default function LogsTable({
};

// Use streaming logs only when actively streaming, otherwise use initial logs
const displayLogs = isStreaming ? streamingLogs : initialLogs;
// Keep streamingLogs visible until initialLogs are populated (avoids blank flash)
const displayLogs = isStreaming || streamingLogs.length > 0
? (streamingLogs.length > 0 ? streamingLogs : initialLogs)
: initialLogs;

// Add index to logs for virtual list key
const logsWithIndex: LogEntryWithIndex[] = useMemo(() => {
Expand Down
Loading