mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #2383] [MERGED] Memoize conversation message rendering to stop the streaming re-parse storm #5571
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#5571
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2383
Author: @Romuromylus
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/6/2026
Merged by: @Romuromylus
Base:
refactor← Head:fix/streaming-render-storm📝 Commits (2)
2ad2b7cMemoize conversation message rendering to stop the streaming re-parse storm73a2dbdMemoize the combined split-message object to cut streaming re-renders📊 Changes
3 files changed (+112 additions, -25 deletions)
View changed files
📝
src/features/modes/conversation/components/ConversationMessage.tsx(+28 -16)📝
src/features/modes/conversation/components/ConversationView.tsx(+21 -9)➕
src/features/modes/conversation/components/MessageContent.test.tsx(+63 -0)📄 Description
Linked issue
Closes #2304
Why this change
While a message generates,
ConversationViewre-renders on every ~45ms stream-buffer commit (~22x/sec).MessageContentranrenderMarkdownBlocksdirectly in its render body and was not memoized, so every mounted message (up to the full render window) re-parsed its entire markdown on each commit — the streaming render storm.What changed
MessageContentinReact.memoand compute the parsed output in auseMemokeyed oncontent/mentionNames, sorenderMarkdownBlocksonly re-runs for a message whose content actually changed.onImageOpencallback (useCallback) so the memo can bail.useMemoruns unconditionally before the image-URL early return, keeping the Rules of Hooks intact.Refactor impact
Primary owner: chat / conversation mode UI (
src/features/modes/conversation/components/ConversationMessage.tsx)Impact areas reviewed:
MessageContentis conversation-mode-scoped;renderedContent(macro-resolved string) andmentionNamesare already memoized upstream, so the memo bails for unchanged messages during streaming.Boundary notes:
Pressure points touched:
Validation
pnpm checkpasses before PR push/handoffManual verification notes
pnpm vitest run src/features/modes/conversation/components/MessageContent.test.tsx— 3 passed (no re-parse on unchanged content across re-renders with a newonImageOpenidentity; re-parse on content change; image URL bypasses parse).pnpm exec tsc -b— clean.pnpm exec eslinton the touched files — clean.Feature Discoverability
Reason:
Docs and release impact
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.