Files
openchamber/packages
Hernan Javier Ardila Sanchezandherjarsa 1abb0dc103 fix(chat): set scroll position before paint on session-switch replay (#1730)
Replace useEffect with useLayoutEffect in the pendingInitialRestoreRef
replay so restoreSnapshot runs synchronously after DOM commit, before
the browser paints. Prevents visible flash of content at the wrong
scroll position when the scroll container mounts after session
hydration.

Adapted from openchamber/openchamber#1553 (Fix 2). The virtualVersion
counter (Fix 1) is not applicable: virtua (post #1651) does not use
useVirtualizer's useState-based instance pattern that motivated it.

Validation:
- bun --cwd packages/ui type-check - no new errors in useChatAutoFollow.ts
- bun --cwd packages/ui lint - passed

Co-authored-by: herjarsa <herjarsa@users.noreply.github.com>
2026-06-24 17:28:46 +03:00
..