mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-18 13:40:22 +00:00
ad1843f31b
_compensateScrollForMeasurementDelta re-found its viewport anchor only by rawIdx and bailed with a bare 'if(!row) return' when that row was recycled out of the render window. On long sessions containing multi-thousand-px turns, a large scroll delta recycles the anchor row, so the estimated->measured topPad swap (a scrollHeight change of tens of thousands of px) hit scrollTop uncompensated and threw the viewport to the top -- a mobile scroll jump-back that did not reproduce on desktop (where the anchor row stays rendered). Fall back when the rawIdx row is gone: (1) re-find the same row by its stable data-session-msg-idx and compensate by its measured offset delta; (2) if that row is also unrendered, compensate by the top-spacer (topPad) height delta captured before the re-render. _captureMessageViewportAnchor now records topPadBefore so the fallback has a reference. Adds tests/test_issue4346_vscroll_recycled_anchor_jumpback.py (Node-harness behavioral tests). All fail on the pre-fix bare-return and pass on the fix; existing vscroll suites stay green. Relates to #4346.