chore: cleanup per Greptile review

- Remove dead _scrollAnchorRestore variable (returns undefined)
- Remove redundant _fixMobileScrollJank() call from _doRender()
  (CSS already gives overflow-anchor:auto on mobile via media query;
   desktop exits guard early — call was a no-op on every tick)
- Update JSDoc on _fixMobileScrollJank to reflect actual usage
This commit is contained in:
akrhin committed 2026-06-24 09:38:01 +03:00
1 parent 98688491c1
commit c4e82c6155
2 files changed
+3 -5

No files matched your search

-3
View File
@@ -3844,9 +3844,6 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
_renderPending=false;
// Guard: a pending setTimeout+rAF can outlive stream finalization.
if(_streamFinalized) return;
// Mobile scroll-jank guard: enable overflow-anchor before DOM writes so
// the browser preserves scroll position during streaming content growth.
if(typeof window._fixMobileScrollJank==='function') window._fixMobileScrollJank();
_lastRenderMs=performance.now();
const parsed=_cachedParsed&&_cachedParsedText===assistantText&&_cachedParsedReasoning===liveReasoningText ? _cachedParsed : _parseStreamState();
_cachedParsed=null;
+3 -2
View File
@@ -10993,7 +10993,8 @@ function _restoreMessageScrollSnapshot(snapshot){
* browser preserves scroll position across the innerHTML='' + DOM rebuild gap.
* Safari/Chrome on iOS/Android can paint a frame with scrollTop=0 between
* innerHTML='' and snapshot restore, scroll-janking the user to the top.
* Also acts as a generic anchor-stabilizer during streaming DOM updates.
* Called from renderMessages() before the DOM wipe — not from streaming ticks,
* since CSS already gives overflow-anchor:auto on mobile via media query.
*/
window._fixMobileScrollJank=function _fixMobileScrollJank(){
const el=document.getElementById('messages');
@@ -11245,7 +11246,7 @@ function renderMessages(options){
// preserves scroll position across the DOM wipe-and-rebuild gap.
// Safari/Chrome on iOS/Android can paint a frame with scrollTop=0 between
// innerHTML='' and snapshot restore, scroll-janking the user to the top.
const _scrollAnchorRestore=window._fixMobileScrollJank&&window._fixMobileScrollJank();
if(window._fixMobileScrollJank) window._fixMobileScrollJank();
inner.innerHTML='';
const compressionNode=compressionState?_compressionCardsNode(compressionState):null;
const {message:referenceMessage, rawIdx:referenceMessageRawIdx}=_latestCompressionReferenceMessage(