Fix one-time content jump when reactivating a room at the bottom#904
Merged
Conversation
On a room switch MessageList remounts and the virtualizer is seeded from the persistent row-height cache. @TanStack measures rows via ResizeObserver; on WebKit the settled measurement is delivered late (after the row is windowed out or the list unmounts), so the cache keeps the row's transient pre-settle height. The next entry seeds that wrong height, the visible rows reflow to their real height after the first paint, and the bottom-pin re-asserts — a one-time content jump (visible on WebKit, smooth on Chromium). Snapshot each mounted row's settled offsetHeight on unmount and write it back to the cache, overriding the transient value, so the next seed matches the render and there is no post-paint reflow.
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.
Switching away from a room and back (at the bottom) caused the message list to visibly jump once on Tauri/WebKit.
Cause:
MessageListremounts per room and the virtualizer is seeded from the persistent row-height cache. @TanStack measures rows viaResizeObserver; on WebKit the settled measurement is delivered late — after the row is windowed out or the list unmounts — so the cache keeps the row's transient pre-settle height. The next entry seeds that wrong height, the visible rows reflow to their real height after the first paint, and the bottom-pin re-asserts. Chromium repaints this smoothly (invisible); WebKit shows it as a one-time jump, every switch.Fix: snapshot each mounted row's settled
offsetHeighton unmount and write it back to the cache, overriding the transient value. The next seed then matches the render exactly, so there is no post-paint reflow and no re-pin.Additive — does not touch the pin loop. Verified via typecheck and the MessageList/height-cache unit tests. The visual fix is WebKit-specific and needs confirmation on
tauri:dev.