Repository navigation
fix(session-ui): dispose live markdown renderer when blocks settle - #56995
Draft
kitlangton wants to merge 1 commit into
Draft
kitlangton wants to merge 1 commit into
kitlangton wants to merge 1 commit into
Conversation
kitlangton
force-pushed
the
markdown-live-dispose
branch
from
October 23, 2026 17:16
1ebe5cc to
c28309d
Compare
kitlangton
force-pushed
the
markdown-live-dispose
branch
from
October 23, 2026 17:30
c28309d to
d762e65
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Streamed Markdown blocks kept their live Solid renderer and one
<span>per word after they finished, which retained about 1 GB in a long session. Now a block that finishes streaming drops its renderer and word spans while its paragraphs, links, images and the user's selection stay where they are.How it works
createMarkdownRenderermounts withcreateRoot+insertinstead ofrender(), so disposing it doesn't clear the DOM.updateBlockkeeps its element even though block keys include the mode (…:0:livebecomes…:0:full, the normal path in the app).settleMarkdownWordswaits for running[data-markdown-enter]fade-ins, then unwraps each word span in place, restores the selection withsetBaseAndExtent(so backward and in-progress drags keep their anchor), and callsnormalize(). Live ranges follow merged text nodes, so the selection survives and each run of words is one text node again, which in-app Find needs to match across words.Risk
UI only (
packages/session-uiMarkdown). Things to know:isConnected, mode and hash first).Proof
bun test src/components/markdown-solid.test.tsxinpackages/session-ui: 6 pass (unwrap in place, cross-block and backward selection, waiting for fade-ins)bun test src/components/markdowninpackages/session-ui: 118 passhivemind run --kind browser -- bunx playwright test --config playwright.components.config.ts component-tests/markdown.spec.ts: 30 passed in Chromium, including"llo wor"), and leaves the paragraph as["Hello ", <strong>, " again"]text nodes:fullkeybun run typecheckinpackages/session-ui: 0 errorsbun run lint:changed: 0 problems