Skip to content

Commit 700253c

Browse files
🤖 fix: use static mode for completed markdown to prevent render delay (#921)
## Summary Fixes plan body taking 10+ seconds to render after the ORPC migration. ## Root Cause After ORPC, IPC events go through async iterators with microtask boundaries, giving React more opportunities to deprioritize Streamdown's `useTransition()` indefinitely. ## Fix Set `mode="static"` for completed content (`parseIncompleteMarkdown=false`) to bypass `useTransition()` and render immediately. This aligns with Streamdown's intended API: - `mode="streaming"` - for incremental content, uses `useTransition()` - `mode="static"` - for complete content, renders immediately Even if this doesn't fully resolve the delay, the change is correct regardless - we were incorrectly using streaming mode for all content, including completed messages. --- _Generated with `mux`_
1 parent b061c16 commit 700253c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

‎bun.lock‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"lockfileVersion": 1,
3+
"configVersion": 0,
34
"workspaces": {
45
"": {
56
"name": "mux",

‎src/browser/components/Messages/MarkdownCore.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export const MarkdownCore = React.memo<MarkdownCoreProps>(
6262
remarkPlugins={REMARK_PLUGINS}
6363
rehypePlugins={REHYPE_PLUGINS}
6464
parseIncompleteMarkdown={parseIncompleteMarkdown}
65+
// Use "static" mode for completed content to bypass useTransition() deferral.
66+
// After ORPC migration, async event boundaries let React deprioritize transitions indefinitely.
67+
mode={parseIncompleteMarkdown ? "streaming" : "static"}
6568
className="space-y-2" // Reduce from default space-y-4 (16px) to space-y-2 (8px)
6669
controls={{ table: false, code: true, mermaid: true }} // Disable table copy/download, keep code/mermaid controls
6770
>

0 commit comments

Comments
 (0)