Skip to content

fix(desktop): keep the timeline settle write out of the resize pass - #5771

Open
chessing234 wants to merge 2 commits into
block:mainfrom
chessing234:fix/virtualized-viewport-resize-loop
Open

chessing234 wants to merge 2 commits into
block:mainfrom
chessing234:fix/virtualized-viewport-resize-loop

Conversation

@chessing234

@chessing234 chessing234 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Refs #5717.

A scroll write inside the viewport resize observer can re-measure virtualized rows and deliver another resize in the same pass. The browser then reports ResizeObserver loop completed with undelivered notifications.

Changes

  • Queue a single scroll write for the next animation frame and cancel it when the observer disconnects.
  • Compare the observed content box so a scrollbar change still counts as a resize. Skip unchanged geometry for bottom settling and keep the first delivery active.
  • Preserve the held-message behavior from fix(desktop): hold a deep-linked message against bottom settles #8742. Recheck the hold and bottom state in the queued frame so a newly held message stays anchored and a reader who has scrolled away keeps their position.

Verification

  • All 7,147 desktop tests passed with the pinned Node and pnpm versions. Desktop type-checking and Biome checks on the changed files passed.
  • All five Playwright message-link scenarios passed in Chromium, including links into unloaded history and links in other channels.
  • Two more Chromium checks passed for composer growth at the bottom and offscreen row resizing while holding a reading position.

`useVirtualizedViewportResize` called `settleAtBottom` synchronously from
its ResizeObserver callback. That path runs `pinToBottom` ->
`scrollToIndex`, which shifts Virtua's rendered range, re-measures rows
and can toggle the scrollbar -- resizing the observed element at a deeper
depth of the pass that is delivering to us. The browser detects the
re-entrancy and logs "ResizeObserver loop completed with undelivered
notifications" continuously on a live channel.

Defer the settle to the next animation frame, mirroring the rAF defer the
sibling observer in `useVirtualizedBottomSettle` already uses, and skip
deliveries whose geometry is unchanged -- the callback took no `entries`,
so a resize that round-tripped to the same layout still scrolled.

Lift the callback into `createVirtualizedViewportResizeHandler` so the
frame handling is testable without a DOM.

Refs block#5717

Signed-off-by: Taksh <takshkothari09@gmail.com>
@chessing234
chessing234 requested a review from a team as a code owner August 13, 2026 16:04
Signed-off-by: Taksh <takshkothari09@gmail.com>
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is d839d3731a11ab363a69e7f5b851c3031b7680dd...be01758c524a3ce50f002bd13f576204510f370d.
A new review must complete for this exact range. When manual authorization
is required, a user with write access must comment exactly
@buzz-security-review be01758c524a3ce50f002bd13f576204510f370d to authorize a new review.
Any previous review applies only to its recorded range.

This branch has not been deployed

No deployments
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