Skip to content

Commit 77f2b27

Browse files
committed
fix(ui): extract useStreamingReveal to followup, keep cleanup changes
1 parent aba72b8 commit 77f2b27

File tree

2 files changed

+8
-141
lines changed

2 files changed

+8
-141
lines changed

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/chat-content/chat-content.tsx

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
SpecialTags,
1919
} from '@/app/workspace/[workspaceId]/home/components/message-content/components/special-tags'
2020
import type { MothershipResource } from '@/app/workspace/[workspaceId]/home/types'
21-
import { useStreamingReveal } from '@/hooks/use-streaming-reveal'
2221
import { useStreamingText } from '@/hooks/use-streaming-text'
2322

2423
const LANG_ALIASES: Record<string, string> = {
@@ -264,11 +263,6 @@ export function ChatContent({
264263
const parsed = useMemo(() => parseSpecialTags(rendered, isStreaming), [rendered, isStreaming])
265264
const hasSpecialContent = parsed.hasPendingTag || parsed.segments.some((s) => s.type !== 'text')
266265

267-
const { committed, incoming, generation } = useStreamingReveal(
268-
rendered,
269-
!hasSpecialContent && isStreaming
270-
)
271-
272266
if (hasSpecialContent) {
273267
type BlockSegment = Exclude<
274268
ContentSegment,
@@ -336,38 +330,14 @@ export function ChatContent({
336330
}
337331

338332
return (
339-
<div>
340-
{committed && (
341-
<div
342-
className={cn(
343-
PROSE_CLASSES,
344-
'[&>:first-child]:mt-0',
345-
!incoming && '[&>:last-child]:mb-0'
346-
)}
347-
>
348-
<Streamdown mode='static' components={MARKDOWN_COMPONENTS}>
349-
{committed}
350-
</Streamdown>
351-
</div>
352-
)}
353-
{incoming && (
354-
<div
355-
key={generation}
356-
className={cn(
357-
PROSE_CLASSES,
358-
'[&>:first-child]:mt-0 [&>:last-child]:mb-0',
359-
isStreaming && 'animate-stream-fade-in'
360-
)}
361-
>
362-
<Streamdown
363-
mode={isStreaming ? undefined : 'static'}
364-
isAnimating={isStreaming}
365-
components={MARKDOWN_COMPONENTS}
366-
>
367-
{incoming}
368-
</Streamdown>
369-
</div>
370-
)}
333+
<div className={cn(PROSE_CLASSES, '[&>:first-child]:mt-0 [&>:last-child]:mb-0')}>
334+
<Streamdown
335+
mode={isStreaming ? undefined : 'static'}
336+
isAnimating={isStreaming}
337+
components={MARKDOWN_COMPONENTS}
338+
>
339+
{rendered}
340+
</Streamdown>
371341
</div>
372342
)
373343
}

apps/sim/hooks/use-streaming-reveal.ts

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)