mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-05-25 19:20:16 +00:00
93f30ecfda
Opus advisor on stage-302 (#1732 verification Q5) flagged that _lastScrollTop is module-global and persists across chat switches. When the user switches sessions, the new chat's first user scroll compares against the previous chat's last scrollTop. If the previous was deep- scrolled (e.g. 5000) and the new chat starts at top=0, scrolling down to 100 would evaluate as movedUp=true → false-unpin, blocking auto- scroll on the new chat's first incoming token. Fix: expose _resetScrollDirectionTracker() from static/ui.js on window so static/sessions.js loadSession() can reset _lastScrollTop=null when S.session is reassigned. The scroll listener's existing _lastScrollTop!==null guard then handles the first sample after reset correctly (no false-trigger on the very first scroll event in the new chat). Absorb-in-release per Opus stage-302 verdict — small, defensive, ≤20 LOC.