summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/message-part.tsx
diff options
context:
space:
mode:
authorShoubhit Dash <[email protected]>2026-03-27 01:13:30 +0530
committerGitHub <[email protected]>2026-03-26 14:43:30 -0500
commitb7a06e193952a66a8efa07feb4e105f44bf7ea8b (patch)
tree7a3be05378787f09779c18eed61d7956c9122e1f /packages/ui/src/components/message-part.tsx
parent311ba4179a3c112a7e0cbbeae152a971284a3632 (diff)
downloadopencode-b7a06e193952a66a8efa07feb4e105f44bf7ea8b.tar.gz
opencode-b7a06e193952a66a8efa07feb4e105f44bf7ea8b.zip
fix(ui): reduce markdown jank while responses stream (#19304)
Diffstat (limited to 'packages/ui/src/components/message-part.tsx')
-rw-r--r--packages/ui/src/components/message-part.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/packages/ui/src/components/message-part.tsx b/packages/ui/src/components/message-part.tsx
index a15e2e0c1..8b572aff8 100644
--- a/packages/ui/src/components/message-part.tsx
+++ b/packages/ui/src/components/message-part.tsx
@@ -1334,6 +1334,9 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
const displayText = () => (part().text ?? "").trim()
const throttledText = createThrottledValue(displayText)
+ const streaming = createMemo(
+ () => props.message.role === "assistant" && typeof (props.message as AssistantMessage).time.completed !== "number",
+ )
const isLastTextPart = createMemo(() => {
const last = (data.store.part?.[props.message.id] ?? [])
.filter((item): item is TextPart => item?.type === "text" && !!item.text?.trim())
@@ -1360,7 +1363,7 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
<Show when={throttledText()}>
<div data-component="text-part">
<div data-slot="text-part-body">
- <Markdown text={throttledText()} cacheKey={part().id} />
+ <Markdown text={throttledText()} cacheKey={part().id} streaming={streaming()} />
</div>
<Show when={showCopy()}>
<div data-slot="text-part-copy-wrapper" data-interrupted={interrupted() ? "" : undefined}>
@@ -1394,11 +1397,14 @@ PART_MAPPING["reasoning"] = function ReasoningPartDisplay(props) {
const part = () => props.part as ReasoningPart
const text = () => part().text.trim()
const throttledText = createThrottledValue(text)
+ const streaming = createMemo(
+ () => props.message.role === "assistant" && typeof (props.message as AssistantMessage).time.completed !== "number",
+ )
return (
<Show when={throttledText()}>
<div data-component="reasoning-part">
- <Markdown text={throttledText()} cacheKey={part().id} />
+ <Markdown text={throttledText()} cacheKey={part().id} streaming={streaming()} />
</div>
</Show>
)