@@ -267,7 +267,7 @@ export const Thread: FC<{
267267 </ ThreadPrimitive . ViewportFooter >
268268 </ ThreadPrimitive . Viewport >
269269
270- { showArtifacts && artifacts . length > 0 ? < ThreadOutputs artifacts = { artifacts } /> : null }
270+ { showArtifacts ? < ThreadOutputs artifacts = { artifacts } /> : null }
271271 </ div >
272272 </ ThreadPrimitive . Root >
273273 ) ;
@@ -278,10 +278,7 @@ const ThreadOutputs: FC<{
278278} > = ( { artifacts } ) => {
279279 const visibleArtifacts = useMemo ( ( ) => selectVisibleArtifacts ( artifacts ) , [ artifacts ] ) ;
280280 const [ isExpanded , setIsExpanded ] = useState ( true ) ;
281-
282- if ( visibleArtifacts . length === 0 ) {
283- return null ;
284- }
281+ const hasArtifacts = visibleArtifacts . length > 0 ;
285282
286283 const handleOpenArtifact = useCallback ( ( artifact : RunArtifactRecord ) => {
287284 const content = typeof artifact . content === "string" ? artifact . content : "" ;
@@ -309,23 +306,35 @@ const ThreadOutputs: FC<{
309306 < ChevronDownIcon className = "assistant-outputs-toggle-icon" />
310307 </ button >
311308 < div className = "assistant-outputs-list" role = "list" >
312- { visibleArtifacts . map ( ( artifact ) => {
313- const disabled = typeof artifact . content !== "string" || artifact . content . trim ( ) . length === 0 ;
314- return (
315- < button
316- key = { `${ artifact . r2Key ?? artifact . filename } -${ artifact . createdAt ?? "" } ` }
317- type = "button"
318- className = "assistant-output-link"
319- role = "listitem"
320- onClick = { ( ) => handleOpenArtifact ( artifact ) }
321- disabled = { disabled }
322- title = { disabled ? "This output is not available inline yet." : artifact . filename }
323- >
324- < FileTextIcon className = "assistant-output-link-icon" />
325- < span className = "assistant-output-link-name" > { formatArtifactLabel ( artifact , visibleArtifacts ) } </ span >
326- </ button >
327- ) ;
328- } ) }
309+ { hasArtifacts
310+ ? visibleArtifacts . map ( ( artifact ) => {
311+ const disabled = typeof artifact . content !== "string" || artifact . content . trim ( ) . length === 0 ;
312+ return (
313+ < button
314+ key = { `${ artifact . r2Key ?? artifact . filename } -${ artifact . createdAt ?? "" } ` }
315+ type = "button"
316+ className = "assistant-output-link"
317+ role = "listitem"
318+ onClick = { ( ) => handleOpenArtifact ( artifact ) }
319+ disabled = { disabled }
320+ title = { disabled ? "This output is not available inline yet." : artifact . filename }
321+ >
322+ < FileTextIcon className = "assistant-output-link-icon" />
323+ < span className = "assistant-output-link-name" > { formatArtifactLabel ( artifact , visibleArtifacts ) } </ span >
324+ </ button >
325+ ) ;
326+ } )
327+ : Array . from ( { length : 4 } , ( _ , index ) => (
328+ < div
329+ key = { `output-placeholder-${ index } ` }
330+ className = "assistant-output-placeholder"
331+ role = "listitem"
332+ aria-hidden = "true"
333+ >
334+ < span className = "assistant-output-placeholder-icon" />
335+ < span className = "assistant-output-placeholder-line" />
336+ </ div >
337+ ) ) }
329338 </ div >
330339 </ aside >
331340 ) ;
0 commit comments