From a6a891f07952694edd705da326d20a8c2222f5eb Mon Sep 17 00:00:00 2001 From: Frank Song Date: Sat, 25 Jul 2026 15:03:28 +0800 Subject: [PATCH] fix: keep live render harness fallback safe --- static/ui.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/static/ui.js b/static/ui.js index 7492e5f2..a477fa5a 100644 --- a/static/ui.js +++ b/static/ui.js @@ -12884,7 +12884,15 @@ function renderLiveAnchorActivityScene(streamId, scene, opts){ _dedupeLiveProcessedWorklogAnchors(turn); if(typeof _moveLiveRunStatusToTurnEnd==='function') _moveLiveRunStatusToTurnEnd(); _restoreMessageScrollSnapshotSameFrame(scrollSnapshot); - _restoreLiveAnchorScrollSnapshotAfterRebuild(scrollSnapshot,scrollRebuildGuard); + if(typeof _restoreLiveAnchorScrollSnapshotAfterRebuild==='function'){ + _restoreLiveAnchorScrollSnapshotAfterRebuild(scrollSnapshot,scrollRebuildGuard); + }else if(scrollRebuildGuard&&scrollRebuildGuard.release){ + // Keep extracted test harnesses safe when they omit the shared helper. + requestAnimationFrame(()=>{ + scrollRebuildGuard.release(); + if(_messageUserUnpinned) _restoreMessageScrollSnapshotSameFrame(scrollSnapshot); + }); + } if(!scrollRebuildGuard.readerAwayFromBottom&&typeof scrollIfPinned==='function') scrollIfPinned(); return true; } @@ -12990,7 +12998,15 @@ function _renderLiveAnchorActivitySceneTransparent(streamId, scene, opts){ if(renderedRows.length) _syncTransparentEventControls(turn); if(typeof _moveLiveRunStatusToTurnEnd==='function') _moveLiveRunStatusToTurnEnd(); _restoreMessageScrollSnapshotSameFrame(scrollSnapshot); - _restoreLiveAnchorScrollSnapshotAfterRebuild(scrollSnapshot,scrollRebuildGuard); + if(typeof _restoreLiveAnchorScrollSnapshotAfterRebuild==='function'){ + _restoreLiveAnchorScrollSnapshotAfterRebuild(scrollSnapshot,scrollRebuildGuard); + }else if(scrollRebuildGuard&&scrollRebuildGuard.release){ + // Keep extracted test harnesses safe when they omit the shared helper. + requestAnimationFrame(()=>{ + scrollRebuildGuard.release(); + if(_messageUserUnpinned) _restoreMessageScrollSnapshotSameFrame(scrollSnapshot); + }); + } if(!scrollRebuildGuard.readerAwayFromBottom&&typeof scrollIfPinned==='function') scrollIfPinned(); return !!renderedRows.length; }