fix(desktop): render markdown in real time during streaming#3444
Merged
esengine merged 1 commit intoJun 7, 2026
Conversation
b424ecb to
dd69fef
Compare
The assistant bubble previously rendered raw text while streaming and
only parsed markdown once the turn completed. This created a jarring
visual jump: plain text for seconds, then a sudden reflow into formatted
markdown with headings, code blocks, and lists.
Now <Markdown> runs on every token. The component already uses
useDeferredValue internally, so React prioritises the cursor + layout
frame over the expensive parse — new tokens paint immediately and the
formatted catch-up runs in idle frames without blocking interaction.
Changes:
- Message.tsx: replace raw {item.text} with <Markdown> during streaming,
rename cursor class from .cursor to .msg__cursor for BEM consistency.
- styles.css: update .msg__stream to flex-column layout so the blinking
cursor sits below the markdown content; keep .cursor for any legacy
references.
15c55fc to
b79dd4f
Compare
Contributor
Author
HUQIANTAO
added a commit
to HUQIANTAO/DeepSeek-Reasonix
that referenced
this pull request
Jun 7, 2026
The parent task tool card chevron only toggled args/output visibility;
nested sub-agent calls (read_file / grep / ls from an /explore run)
always rendered underneath. A 50-step /explore flooded the transcript
with its full step list, with no way to fold it back.
Now the open state also controls nested items. A single chevron click
collapses or expands the whole subagent tree. Behavior:
- Open by default while the sub-agent is still "running" so the user
can watch progress.
- Closed by default once it settles, so a finished explore folds to
a single summary line ("12 steps") on first paint.
- Individual sub-calls can still be expanded/collapsed independently.
This is the ToolCard half of the original esengine#3140. The streaming-markdown
half has been merged via esengine#3444.
esengine
pushed a commit
that referenced
this pull request
Jun 8, 2026
The parent task tool card chevron only toggled args/output visibility;
nested sub-agent calls (read_file / grep / ls from an /explore run)
always rendered underneath. A 50-step /explore flooded the transcript
with its full step list, with no way to fold it back.
Now the open state also controls nested items. A single chevron click
collapses or expands the whole subagent tree. Behavior:
- Open by default while the sub-agent is still "running" so the user
can watch progress.
- Closed by default once it settles, so a finished explore folds to
a single summary line ("12 steps") on first paint.
- Individual sub-calls can still be expanded/collapsed independently.
This is the ToolCard half of the original #3140. The streaming-markdown
half has been merged via #3444.
Co-authored-by: HUQIANTAO <HUQIANTAO@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The assistant bubble renders raw plain text while the response is streaming and only switches to rendered markdown (headings, code blocks, lists, tables) once the turn completes. This creates a jarring visual jump — the user reads plain text for seconds, then the entire bubble reflows into formatted markdown.
Root Cause
In
Message.tsx, the streaming branch explicitly renders raw text to avoid "markdown reflow jitter":The comment says partial markdown "reflows the layout and makes the view jitter." This was true before
useDeferredValuewas added to<Markdown>(commit f059d71), but now the deferred render handles this gracefully — React prioritises the cursor and layout frame over the expensive parse.Fix
Render
<Markdown>during streaming. The component already usesuseDeferredValueinternally, so:useDeferredValueChanges
Message.tsx{item.text}with<Markdown text={item.text} />in the streaming branch; rename.cursor→.msg__cursorfor BEM consistencystyles.css.msg__streamfromwhite-space: pre-wraptodisplay: flex; flex-direction: columnso the cursor sits below the markdown block; add.msg__cursorwithmargin-top: 4pxBefore / After
useDeferredValuedefers the expensive parse to idle framesVerification
pnpm typecheck✅ cleanpnpm build✅built in 5.13s