Skip to content

fix: auto-collapse lazy-loaded files in PR diff view#13

Merged
rrbe merged 2 commits intomainfrom
fix/pr-collapse-lazy-load
Apr 21, 2026
Merged

fix: auto-collapse lazy-loaded files in PR diff view#13
rrbe merged 2 commits intomainfrom
fix/pr-collapse-lazy-load

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented Apr 20, 2026

Summary

  • Track the user's last-applied collapse/expand intent on the PR diff toggle and reapply it to files GitHub lazy-loads as the user scrolls further down the PR.
  • Stabilize the toggle button label so it stays consistent with the user's intent instead of flipping based on the ratio of collapsed files currently in the DOM.
  • Reset intent/observer when a fresh button is injected so state doesn't leak across SPA navigations.

Test plan

  • Open a large PR, click Collapse all files, scroll down and confirm newly lazy-loaded files render collapsed.
  • From the collapsed state, click Expand all files and verify both current and newly-loaded files expand.
  • Manually expand a single collapsed file and scroll further — confirm the manually-expanded file stays expanded while new lazy-loaded files still honor the intent.
  • Navigate to another PR via client-side nav and confirm the button's label reflects that PR's fresh state (no stale intent carried over).

🤖 Generated with Claude Code

rrbe and others added 2 commits April 21, 2026 00:26
Track user's last-applied collapse/expand intent and use a MutationObserver
to apply that intent to files that GitHub lazy-loads as the user scrolls.
Also stabilizes the toggle button label so it no longer flips when new
files are rendered into the DOM.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit 174dc59 into main Apr 21, 2026
@rrbe rrbe deleted the fix/pr-collapse-lazy-load branch April 21, 2026 01:38
@rrbe rrbe restored the fix/pr-collapse-lazy-load branch April 21, 2026 02:34
@rrbe rrbe deleted the fix/pr-collapse-lazy-load branch April 21, 2026 02:34
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