Skip to content

fix(session-ui): render Mermaid after remounting messages - #45768

Closed
opencode-agent[bot] wants to merge 1 commit into
v2from
mermaid-tab-repro
Closed

opencode-agent[bot] wants to merge 1 commit into
v2from
mermaid-tab-repro

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

Fix Mermaid diagrams reverting to source code when returning to a completed message in the web/desktop session UI.

Streaming code blocks already call decorateMermaid, but completed messages mount through the full-HTML path, which skipped that decoration. Decorate completed Mermaid fences using the existing renderer without storing generated SVG in the Markdown cache.

Validation

  • Reproduced the missing diagram after streaming completion and unmount/remount on 5d4ce14dc476123032ecbcff31bbd51f03831530; the same transition now retains a visible diagram.
  • Four new browser cases cover streamed completion, completed messages, preloaded cache hits, multiple diagrams, invalid-diagram fallback, replacement content, and focus retention.
  • All four new cases and all three existing Markdown component cases pass.
  • 41 focused Markdown unit tests pass.
  • bun typecheck passes in packages/session-ui.
  • Prettier and git diff --check pass.

Browser tests exercise the production Markdown component through the existing Storybook fixture, not a full session-tab end-to-end flow. Each browser case was run separately with a fresh Chromium instance and reduced thread settings because of host resource limits. Before/after screenshots were inspected using identical fixture content and the component's real rendering path.

The TUI report is not claimed fixed by this PR; it uses a separate renderer and needs the reporter's exact source/version to identify their failure.

Requested by: @kitlangton (Kit via Slack)

@opencode-agent

Copy link
Copy Markdown
Contributor Author

Superseded by #45773, which fixed the remount path and added regression coverage.

@opencode-agent opencode-agent Bot closed this Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant