Repository navigation
fix(native-chat): keep diagram source mounted and retire reveal history - #26690
Conversation
…history by message id - MermaidBlock: a result goes stale only when its source changes, so a theme switch keeps the old diagram until the new one renders instead of flashing back to source. - Reply reveals keep only loaded message ids (conversation rows plus subagent rows), since only message rows reveal; drops the separate row inventory and restores nativeChatSlotKey to the slots module. - CommentMarkdownDocumentPre: drop the unreachable renderMermaid half of the fence check. - Tests: Mermaid stays idle while streaming (waits past the async load), theme change keeps the diagram, held renders are settled after each test, a reopened subagent section does not replay its streaming reply through the real list, and retirement is tested by outcome.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a0a6aa57-71b3-4b2d-9e58-5994cd0274f7
📒 Files selected for processing (8)
src/renderer/src/components/editor/MermaidBlock.tsxsrc/renderer/src/components/native-chat/NativeChatMarkdown.mermaid.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.subagent-sections.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptItems.tsxsrc/renderer/src/components/native-chat/native-chat-reply-reveals.test.tsxsrc/renderer/src/components/native-chat/native-chat-reply-reveals.tssrc/renderer/src/components/sidebar/comment-markdown-code-renderers.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| } | ||
| // Only message rows reveal, and only loaded ones can return, so nothing else is kept. | ||
| for (const key of state.known) { | ||
| if (!loadedMessageIds.has(key)) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Retire unloaded IDs before classifying the last row.
When the loaded window changes directly from windowAt(0) to windowAt(300), state.known still contains the old 300 IDs at the earlier lastKey check. The hook marks row-599 as a newly begun reply, although it arrived with loaded history. Remove IDs outside loadedMessageIds before that check. Also assert that the replacement window does not begin a reveal. (raw.githubusercontent.com)
Review summaryThe problem. Merged #26238 (native chat replies flow in) left two issues:
What changes for you.
Fixed during review (commit 5c31c87):
Deferred, all small:
Verified:
Not verified:
|
ELI5
Two small problems in native chat, left over from #26238 (replies that flow in):
Both are fixed. Nothing else about how replies or diagrams look should change.
What Changed
What you see
Mechanism
renderEnabledprop onMermaidBlockkeeps Mermaid idle while the reply streams, so the source block underneath is the same element throughout.Reveal history
Why
Linked Issue
Follow-up to #26238, originally contributed by @AmoabaKelvin. No separate issue.
Visual Proof
Recorded in a hidden, isolated dev build on Windows. A stand-in agent streamed a fixed reply with a wide Mermaid diagram. The source was scrolled sideways with a real horizontal mouse-wheel event while the reply streamed. Base is merged #26238 (
3c075883ed3); after is this PR (5c31c8795bd).Reply just finished, diagram not drawn yet
What the samples show:
Theme switch (dark → light → dark)
Later replies
Not checked in the app:
Testing
Each new test fails when the fix it covers is undone:
scrollLeft90 and the Copy button's focus all survive the end of streaming, until the diagram or its error is ready.Runs:
CommentMarkdown*/CommentMermaidBlock*and editorMermaidBlocksuites.orca-ci-checks) pass locally.Review
The PR went through two review rounds and a release-readiness check. The review summary is in a PR comment.
Agent skill upstream boundary
Notes
mobile/imports none of the changed modules) or keyboard shortcuts change.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)