Skip to content

Fix one-time content jump when reactivating a room at the bottom#904

Merged
mremond merged 1 commit into
mainfrom
mr/fix-reactivation-blink-height-snapshot
Jul 7, 2026
Merged

Fix one-time content jump when reactivating a room at the bottom#904
mremond merged 1 commit into
mainfrom
mr/fix-reactivation-blink-height-snapshot

Conversation

@mremond

@mremond mremond commented Jul 7, 2026

Copy link
Copy Markdown
Member

Switching away from a room and back (at the bottom) caused the message list to visibly jump once on Tauri/WebKit.

Cause: MessageList remounts per room 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. Chromium repaints this smoothly (invisible); WebKit shows it as a one-time jump, every switch.

Fix: snapshot each mounted row's settled offsetHeight on 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.

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.
@mremond mremond added this to the 0.17.1 milestone Jul 7, 2026
@mremond mremond merged commit b93585a into main Jul 7, 2026
3 checks passed
@mremond mremond deleted the mr/fix-reactivation-blink-height-snapshot branch July 7, 2026 14:31
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