mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 04:49:39 +08:00
* fix(web): settle scroll to bottom after loading chat history Every message wrapper uses content-visibility: auto with containIntrinsicSize placeholders, so the first scrollTop = scrollHeight pin in useLayoutEffect lands on an estimated "fake bottom" before the browser lays out real heights. Reopening a long history session could therefore stop mid-conversation instead of at the true bottom. - Re-arm autoscroll and re-pin with a double requestAnimationFrame after session load completes, once real heights are laid out - Listen for capture-phase load events in the post-stream observer so lazy images that settle inside the window also re-pin to the bottom * fix(web): re-pin only on a cold open, and describe the real mechanism Two corrections to this branch's own fix: - The re-arm and re-pin ran on every completed load, including the background revalidate of a session painted instantly from cache. A reader who opened a known session and scrolled up to re-read something got yanked to the bottom when that round trip landed. Cold opens are the case with a stale pin; gate on it, and check the abort signal inside the queued frames so a superseded load cannot move a viewport that now belongs to a newer session. - The comment justified the double-rAF with ``content-visibility: auto`` and ``containIntrinsicSize`` placeholders, which do not appear anywhere in web/. The heights that actually arrive late are lazily-loaded images and the next/dynamic capability viewers. Same for the hook's listener: opening a history session is not its path (that effect does not re-run on a session switch), the window right after a stream stops is. --------- Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>