fix(differ): prevent auto-scroll from overwriting comment jump on file switch#507
Merged
fix(differ): prevent auto-scroll from overwriting comment jump on file switch#507
Conversation
When switching files via a sidebar comment click, the jump-to-comment effect fired before dimension effects measured the new file's DOM, causing scrollToRow to use stale dimensions and land at the wrong position. Wrap both jump-to-comment and jump-to-line scroll calls in requestAnimationFrame to let dimension effects run first, matching the existing pattern used by the auto-scroll effect. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…itch Reverts the requestAnimationFrame wrapping from 85b5f16 (which caused scrolling to the top instead of the comment) and adds [jump-comment] console.info logs throughout the jump-to-comment flow: - handleSelectComment trigger and selectFile resolution - setAlignments effect and scroll reset - auto-scroll effect (skip/fire) - dimension measurement effects - focusCommentInViewer with span/displayRange - scrollController.scrollToRow, scrollTo, setAlignments Filter in devtools with: [jump-comment] Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e switch When the auto-scroll effect skipped due to a pending jumpToComment, it did not set lastAutoScrolledFile. After the jump-to-comment effect consumed the token and scrolled to the correct position, the lastHandledJumpToken change caused the auto-scroll effect to re-run. Since lastAutoScrolledFile was never set for the new file, it proceeded to schedule a rAF that scrolled to the first hunk, overwriting the comment position. Set lastAutoScrolledFile in both jump-pending skip paths so the auto-scroll effect cannot re-fire for the same file after a jump completes. Also removes the diagnostic [jump-comment] console.info logging from the previous commit. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastAutoScrolledFileis updated even when auto-scroll is skipped due to a pending comment/line jumpTest plan
🤖 Generated with Claude Code