@@ -324,8 +324,6 @@ const TaskLogPreview: FC<TaskLogPreviewProps> = ({
324324 headerAction,
325325 snapshotAt,
326326} ) => {
327- const hasLogs = logs . length > 0 ;
328-
329327 // Scroll to the bottom on mount since snapshot logs are static.
330328 const scrollToBottom = useCallback ( ( el : HTMLDivElement | null ) => {
331329 if ( ! isChromatic ( ) && el ) {
@@ -348,37 +346,43 @@ const TaskLogPreview: FC<TaskLogPreviewProps> = ({
348346 </ span >
349347 { headerAction }
350348 </ div >
351- { hasLogs ? (
352- < ScrollArea className = "h-96" >
353- < div
354- ref = { scrollToBottom }
355- className = "p-4 font-mono text-xs text-content-secondary leading-relaxed whitespace-pre-wrap break-words"
356- >
357- { logs . map ( ( entry , index ) => {
358- const prev = index === 0 ? undefined : logs [ index - 1 ] ;
359- const isNewGroup = ! prev || prev . type !== entry . type ;
360- return (
361- < div
362- key = { entry . id }
363- className = { cn (
364- "pl-3 border-0 border-l-2 border-solid" ,
365- entry . type === "input"
366- ? "border-l-border-pending"
367- : "border-l-border-purple" ,
368- isNewGroup && index > 0 && "mt-4" ,
369- ) }
370- >
371- { isNewGroup && (
372- < div className = "text-content-primary font-semibold mb-1" >
373- { entry . type === "input" ? "[user]" : "[agent]" }
374- </ div >
375- ) }
376- { entry . content || "\u00A0" }
377- </ div >
378- ) ;
379- } ) }
380- </ div >
381- </ ScrollArea >
349+ { snapshotAt ? (
350+ logs . length > 0 ? (
351+ < ScrollArea className = "h-96" >
352+ < div
353+ ref = { scrollToBottom }
354+ className = "p-4 font-mono text-xs text-content-secondary leading-relaxed whitespace-pre-wrap break-words"
355+ >
356+ { logs . map ( ( entry , index ) => {
357+ const prev = index === 0 ? undefined : logs [ index - 1 ] ;
358+ const isNewGroup = ! prev || prev . type !== entry . type ;
359+ return (
360+ < div
361+ key = { entry . id }
362+ className = { cn (
363+ "pl-3 border-0 border-l-2 border-solid" ,
364+ entry . type === "input"
365+ ? "border-l-border-pending"
366+ : "border-l-border-purple" ,
367+ isNewGroup && index > 0 && "mt-4" ,
368+ ) }
369+ >
370+ { isNewGroup && (
371+ < div className = "text-content-primary font-semibold mb-1" >
372+ { entry . type === "input" ? "[user]" : "[agent]" }
373+ </ div >
374+ ) }
375+ { entry . content || "\u00A0" }
376+ </ div >
377+ ) ;
378+ } ) }
379+ </ div >
380+ </ ScrollArea >
381+ ) : (
382+ < p className = "px-4 py-3 text-sm text-content-secondary m-0" >
383+ No log messages in this snapshot.
384+ </ p >
385+ )
382386 ) : (
383387 < p className = "px-4 py-3 text-sm text-content-secondary m-0" >
384388 No log snapshot available. Resume your task to view logs.
0 commit comments