How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€

Ever get stuck clicking through endless “Load diff” buttons on a giant GitHub pull request? It’s the worst, right? While I’m all for using VSCode for reviews (seriously, check out my other post on that), if you’re sticking with GitHub, you can run a si…


This content originally appeared on DEV Community and was authored by Krzysztof Platis

Ever get stuck clicking through endless "Load diff" buttons on a giant GitHub pull request? It's the worst, right? While I’m all for using VSCode for reviews (seriously, check out my other post on that), if you’re sticking with GitHub, you can run a simple script in your browser's console to reveal all sections for you.

Paste the script to browser's console

The following script automates what you'd do manually - clicking all buttons to load the diffs — saving you time and effort:

// Expand all "Load diff" buttons in a GitHub PR's /files page
clickLoadDiff = () => {
  buttons = [...document.querySelectorAll('.load-diff-button')];
  if (buttons.length) {
    console.log(buttons);
    buttons.forEach((x) => setTimeout(() => x.click()));
    console.log('Load diff - clicked');
    setTimeout(clickLoadDiff, 1000);
  } else {
    console.log('Load diff - no items to click');
  }
};

clickLoadDiff();

How It Works

  1. Find the Buttons: The script searches for all elements with the class .load-diff-button.
  2. Click Them: It clicks each button, using setTimeout to ensure each click is processed smoothly (in a separate JS macrotask).
  3. Repeat if Necessary: After a second, it checks if there are more buttons to click and repeats the process until there are none left.

If you really feel like buying me a coffee

... then feel free to do it. Many thanks! 🙌

Buy Me A Coffee


This content originally appeared on DEV Community and was authored by Krzysztof Platis


Print Share Comment Cite Upload Translate Updates
APA

Krzysztof Platis | Sciencx (2025-01-08T23:23:44+00:00) How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€. Retrieved from https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/

MLA
" » How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€." Krzysztof Platis | Sciencx - Wednesday January 8, 2025, https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/
HARVARD
Krzysztof Platis | Sciencx Wednesday January 8, 2025 » How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€., viewed ,<https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/>
VANCOUVER
Krzysztof Platis | Sciencx - » How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/
CHICAGO
" » How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€." Krzysztof Platis | Sciencx - Accessed . https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/
IEEE
" » How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€." Krzysztof Platis | Sciencx [Online]. Available: https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/. [Accessed: ]
rf:citation
» How to Reveal All “Load Diff” Sections in a GitHub PR đź‘€ | Krzysztof Platis | Sciencx | https://www.scien.cx/2025/01/08/how-to-reveal-all-load-diff-sections-in-a-github-pr-%f0%9f%91%80/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.