fix(#4778): gate deferred rAF re-restore on still-unpinned (Opus gate)

Opus caught a narrow timing race: if a reader re-pins between the scroll-rebuild
guard engaging and its deferred rAF firing, the stale re-restore would yank them
back off the bottom. Gate the re-restore on _messageUserUnpinned at rAF time; the
minHeight release still always runs. Normal single-render unpinned case unaffected.
This commit is contained in:
nesquena-hermes committed 2026-06-23 16:19:50 +00:00
1 parent f4af6d8419
commit 29ceed3a72
1 file changed
+4 -1
+4 -1
View File
@@ -9682,7 +9682,10 @@ function renderLiveAnchorActivityScene(streamId, scene, opts){
if(scrollRebuildGuard&&scrollRebuildGuard.release){
requestAnimationFrame(()=>{
scrollRebuildGuard.release();
_restoreMessageScrollSnapshotSameFrame(scrollSnapshot);
// Only re-restore the unpinned snapshot if the reader is STILL unpinned at
// rAF time. If they re-pinned between guard-engage and this frame, the
// stale re-restore would yank them back off the bottom (Opus gate finding).
if(_messageUserUnpinned) _restoreMessageScrollSnapshotSameFrame(scrollSnapshot);
});
}
if(!scrollRebuildGuard.readerAwayFromBottom&&typeof scrollIfPinned==='function') scrollIfPinned();