Repository navigation
fix(app): keep thread timeline content in place while rows mount and replies stream - #8548
Open
smsunarto wants to merge 21 commits into
Conversation
Arming content-visibility:auto two frames after a row has painted turns on paint containment late. Chrome then scores every painted child of that row as moved by the scroller's offset (0.71 on a phone cold load of a long thread, 0.96 in a minimal repro), although nothing moves on screen. Rows now carry contain: layout paint style from their first render, so arming only starts skipping offscreen content and the shift is gone (0 in the repro, also after scrolling skipped rows back in).
…changes The scroll keeper re-applied the bottom pin, or a scrolled-up reader's row, only from a ResizeObserver callback. Chrome records layout shifts before ResizeObserver callbacks run, so every streamed chunk scored the Working row, action bar and the rows below the growth as moved, even when the correction landed before paint. The keeper now also remeasures from a MutationObserver on the timeline content, which runs in the same task as the DOM change, so the position is corrected before Chrome looks.
A streaming reply was two Markdown roots: the settled prefix and the live tail. When a block finished it was re-created in the settled root and the tail root moved down by the block's height to show the next block, so the reply scored a shift at every block boundary (up to 0.11 per step on desktop) and, without the bottom pin, visibly jumped. The reply is now one MarkdownPreview over the settled prefix plus the repaired tail. Its incremental pieces keep each finished block's element and key, so the block stays in place and only the live tail re-parses. A test pins the parse volume to what the two roots cost.
…r the plugin A fence a plugin drew before showed a skeleton in its remembered box, but only for the 3 s loading deadline. After it the fence fell back to BB's code block at the code's own height, and when the plugin finally registered (about 35 s on Slow 4G for GenUI) the card swapped in at the remembered height: two shifts that pushed the rest of the reply. While the fence waits for a plugin that is still loading, the remembered box now keeps its size and shows the code, scrollable, with the status line inside it, so the card replaces it in place. Without a remembered box, or once loading fails, the fence behaves as before.
…ross acknowledgement
…dow key across acknowledgement
…ntation until the html renderer loads
…preloads at route entry
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.
Human comments
What was wrong
On a slow connection, the thread timeline moved content that was already on screen (#8547):
content-visibilitytwo frames after painting, and Chrome scores the children of a painted row that becomes contained.What changed
timeline-cold-render (
timeline-row-containment.ts,ThreadTimelineRows.tsx)streaming-reflow (
scroll-position-keeper.ts,ConversationMessageContent.tsx,streaming-markdown-split.ts,markdown-preview.tsx)streaming HTML (
markdown-incremental-pieces.ts,markdown-html.tsx,lazy-markdown-html.tsx,App.tsx)rehype-rawalready uses, now a direct dependency of@bb/app). So attribute text liketitle="x < y", case, void elements and implied end tags can't break nesting.<details>keeps its state.useSyncExternalStore).sent-message-swap (
ThreadTimelineRows.tsx)genui-fence-swap (
markdown-code-fence-renderers.tsx)No wire, CLI or plugin API changes.
HOST_DAEMON_PROTOCOL_VERSIONis unchanged.How you verified
Layout shifts were measured with a Chrome harness on source-built dev instances:
mainate0c49e2e5d; after = this branch.Checks:
pnpm exec turbo run typecheck test lint lint:type-aware --filter=@bb/appon the branch: 10/10 tasks.buildandapps/app/scripts/check-bundle-budget.mjson this branch merged withmainat4d7a9af609: 11/11 tasks, 7597 passed, bundle budget OK.@bb/mobilenot run: no theme tokens or shared-ui files changed.git diff --check: clean.<details>keeping its node;Accepted residuals:
scroll-position-keeper.test.tspins this.Closes #8547