Skip to content

fix(client): render only the target file when jumping to it - #484

Open
ashishnitinpatil wants to merge 1 commit into
yoshiko-pg:mainfrom
ashishnitinpatil:fix/sidebar-jump-renders-all-files
Open

ashishnitinpatil wants to merge 1 commit into
yoshiko-pg:mainfrom
ashishnitinpatil:fix/sidebar-jump-renders-all-files

Conversation

@ashishnitinpatil

Copy link
Copy Markdown

Clicking a file in the sidebar renders every file above it before scrolling. On a large diff (169 files, 46 MB, mostly big JSON files), clicking a file near the bottom rendered 168 files, about 2.2M DOM nodes, and froze the tab for over 45s.

#225 rendered everything above so the target wouldn't drift as the placeholders above it filled in. Browsers with scroll anchoring (Chrome, Firefox, Edge) already keep the target in place, so there a jump (sidebar click or keyboard cursor) now renders only the target, and the files above it render lazily as usual. Same click: about 7s, 31 files rendered. Browsers without it, which may include Safari, keep the old behaviour.

Tested:

  • Unit tests for both paths. The anchoring one fails on main.
  • By hand in Chrome on that diff: the target stays at the top 0.5s, 2s and 5s after the jump, scrolling up 300px from it into unrendered files moves exactly 300px, and [ steps back through files correctly. With CSS.supports stubbed to false, a jump renders every file above as before.
  • Keyboard-navigation benchmark over 3 interleaved rounds against main: -0.8% (60.4ms average vs 60.8ms on main), within run-to-run noise.

🤖 Generated with Claude Code

Clicking a file in the sidebar, or moving the keyboard cursor into an
unrendered file, rendered every file from the top of the list down to
the target. On a large diff (169 files, 46 MB, mostly big JSON fixtures)
clicking a file near the bottom rendered 168 files, built about 2.2M DOM
nodes and froze the tab for over 45 seconds.

yoshiko-pg#225 rendered everything above so the placeholders would not shift the
target as they filled in. Browsers with scroll anchoring already keep the
target in place, so there only the target is rendered and the files above
it render lazily as usual. The same click now renders 31 files and
settles in about 7s. Browsers without scroll anchoring keep the old
behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant