@@ -45,7 +45,10 @@ export default function LogsTable({
4545 startStreaming ( ) ;
4646 } else {
4747 stopStreaming ( ) ;
48- fetchTaskLog ( selectedLog - 1 ) ;
48+ fetchTaskLog ( selectedLog - 1 ) . then ( ( ) => {
49+ // Static logs loaded, safe to clear streaming logs now
50+ setStreamingLogs ( [ ] ) ;
51+ } ) ;
4952 }
5053 return ( ) => stopStreaming ( ) ;
5154 } , [ id , selectedLog , retryCount , shouldStream ] ) ;
@@ -63,7 +66,11 @@ export default function LogsTable({
6366 const logEntry : LogEntry = JSON . parse ( event . data ) ;
6467 if ( logEntry . message === "[END_OF_STREAM]" || logEntry . message === "[HEARTBEAT]" ) {
6568 if ( logEntry . message === "[END_OF_STREAM]" ) {
66- stopStreaming ( ) ;
69+ // Don't clear streamingLogs immediately - keep them visible
70+ // while the static fetch completes
71+ eventSourceRef . current ?. close ( ) ;
72+ eventSourceRef . current = null ;
73+ setIsStreaming ( false ) ;
6774 }
6875 return ;
6976 }
@@ -88,7 +95,10 @@ export default function LogsTable({
8895 } ;
8996
9097 // Use streaming logs only when actively streaming, otherwise use initial logs
91- const displayLogs = isStreaming ? streamingLogs : initialLogs ;
98+ // Keep streamingLogs visible until initialLogs are populated (avoids blank flash)
99+ const displayLogs = isStreaming || streamingLogs . length > 0
100+ ? ( streamingLogs . length > 0 ? streamingLogs : initialLogs )
101+ : initialLogs ;
92102
93103 // Add index to logs for virtual list key
94104 const logsWithIndex : LogEntryWithIndex [ ] = useMemo ( ( ) => {
0 commit comments