Skip to content

fix(renderer): revert stream code block rendering#1602

Merged
zerob13 merged 1 commit into
devfrom
fix/issue-1601
May 11, 2026
Merged

fix(renderer): revert stream code block rendering#1602
zerob13 merged 1 commit into
devfrom
fix/issue-1601

Conversation

@zerob13
Copy link
Copy Markdown
Collaborator

@zerob13 zerob13 commented May 11, 2026

Summary

  • Revert the source-level stream rendering flags for Markdown code blocks.
  • Restore message Markdown loading behavior to the previous part-level state.
  • Remove renderer startup preloading for the new code block runtime path.

Tests

  • pnpm run format
  • pnpm run i18n
  • pnpm run lint
  • pnpm run typecheck
  • pnpm exec vitest run test/renderer/components/MarkdownRenderer.test.ts test/renderer/components/message/MessageBlockContent.test.ts

Summary by CodeRabbit

  • Refactor
    • Refined loading state handling to improve accuracy when displaying markdown content
    • Optimized worker initialization for mathematical expressions and diagram rendering
    • Streamlined rendering configuration across content blocks and thinking sections
    • Removed unnecessary preloading logic for cleaner initialization

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bcf3c4ca-a5de-49c3-8b3d-bbd1c0edca02

📥 Commits

Reviewing files that changed from the base of the PR and between b55f9ba and 497ef99.

📒 Files selected for processing (4)
  • src/renderer/src/components/markdown/MarkdownRenderer.vue
  • src/renderer/src/components/message/MessageBlockContent.vue
  • src/renderer/src/components/think-content/ThinkContent.vue
  • src/renderer/src/main.ts
💤 Files with no reviewable changes (3)
  • src/renderer/src/components/think-content/ThinkContent.vue
  • src/renderer/src/main.ts
  • src/renderer/src/components/markdown/MarkdownRenderer.vue

📝 Walkthrough

Walkthrough

The renderer is refactored to explicitly instantiate and cache KaTeX and Mermaid web workers in main.ts, wiring them into markstream-vue via setter APIs. MarkdownRenderer drops the loading prop contract and stops forwarding loading-derived behavior to NodeRenderer. ThinkContent and MessageBlockContent adjust their NodeRenderer/loading wiring accordingly. Code-block preloading is removed.

Changes

Worker Initialization and Markdown Rendering Simplification

Layer / File(s) Summary
Worker Setup and Registration
src/renderer/src/main.ts
markstream-vue imports change from enableKatex/enableMermaid to worker setters; KaTeX and Mermaid workers are instantiated, cached on globalThis.__markdownWorkers, and registered via setKaTeXWorker/setMermaidWorker; beforeunload cleanup now calls worker terminators and clearer APIs.
Code-Block Preloading Removal
src/renderer/src/main.ts
Theme/language preload arrays and async idle-time preloader functions are removed; scheduleCodeBlockRuntimePreload() call is eliminated.
Markdown Renderer Contract
src/renderer/src/components/markdown/MarkdownRenderer.vue
Optional loading prop is removed from defineProps; NodeRenderer template no longer receives final, typewriter, or codeBlockStream props.
ThinkContent NodeRenderer Wiring
src/renderer/src/components/think-content/ThinkContent.vue
Streaming props (final, typewriter, codeBlockStream) removed from NodeRenderer; live-node buffering controls (maxLiveNodes, liveNodeBuffer) and customId are added.
MessageBlockContent Loading State
src/renderer/src/components/message/MessageBlockContent.vue
MarkdownRenderer :loading binding now uses part.loading instead of props.block.status === 'loading'.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ThinkInAIXYZ/deepchat#1037: Main PR changes how KaTeX/Mermaid workers are instantiated, cached, and wired into markstream-vue at runtime, while the retrieved PR ensures renderer workers are built as ES modules so such Mermaid worker imports/bundling succeed.
  • ThinkInAIXYZ/deepchat#1128: Both PRs touch the markdown renderer integration: the retrieved PR swaps imports from vue-renderer-markdown to markstream-vue, and the main PR continues that change and further adjusts NodeRenderer props and explicitly instantiates/clears Katex/Mermaid workers.
  • ThinkInAIXYZ/deepchat#957: Both PRs modify ThinkContent to use NodeRenderer with customId and adjusted prop configurations.

Suggested labels

codex

Suggested reviewers

  • yyhhyyyyyy

Poem

🐰 Workers now dance in the background bright,
No more loading props to dim the light,
KaTeX and Mermaid spin their wheels,
While nodes stream fast with perfect feels,
A cleaner path for markdown dreams to take flight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: reverting stream code block rendering by removing streaming props and restoring previous loading behavior across multiple components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1601

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zerob13 zerob13 merged commit 38269ff into dev May 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant