Skip to content

Add button to collapse all pull request files diffs #4333

Closed

Description

@rdsedmundo

Problem

When reviewing a fairly large PR the UI can get slow, especially if there's a lot of auto-generated stuff (lots of files, large snapshots, lockfile updates, etc).

Even though Github doesn't load large diffs by default, if you got tons of files with small diffs, it still causes slowness and creates literally an "infinite scroll" when you want to verify for something in specific.

Example PR: https://github.com/babel/babel/pull/5412/files

This one is not that bad, the one that made me thought about it is actually from a private repo that I can't share, but it touched 189 files (mostly editing 3 LOCs everywhere), and huge lock files updates (diff stat was +35000, -32000).

Suggested implementation

  1. Button could be at the left of the "x / y files viewed" section. Could be a hotkey as well on the first file, i.e if you click it holding alt, it collapses everything.
  2. Clicking would trigger something along those lines:
document.querySelectorAll('.file-info > button:first-child[aria-expanded="true"]').forEach(node => node.click());

Activity

  1. jerone commented on May 9, 2021

    @jerone
    Contributor

    Sounds like a feature that already exists: toggle-everything-with-alt.

    Adds a shortcut to toggle all similar items (minimized comments, deferred diffs, etc) at once: alt click on each button or checkbox.

  2. rdsedmundo commented on May 9, 2021

    @rdsedmundo
    Author

    Oh yeah, that does it. I tried searching but used the "pull request" keyword and didn't find anything. Thanks for pointing it out.

  3. locked and limited conversation to collaborators on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions