Refined-github: Add support for loading all large diffs at once

Created on 22 Nov 2017  ·  18Comments  ·  Source: sindresorhus/refined-github


Issuehunt badges

by default larges diffs are not shown. If a PR contains many large diffs, one has to go over them one by one and there is a risk to miss something in a code review.

It would be great to have a button at the top "load all diffs".




IssueHunt Summary

notlmn notlmn has been rewarded.

Backers (Total: $40.00)

- #2087 Restore toggle-all-things-with-alt feature

Tips

IssueHunt has been backed by the following sponsors. Become a sponsor


Rewarded on Issuehunt enhancement good first issue help wanted

Most helpful comment

@sgabler a feature branch can sometimes have many files changed drastically

All 18 comments

Just curious: when do you need to check those large diffs? For me, those are usually auto-generated files that I can safely skip. What is your scenario?

@sgabler a feature branch can sometimes have many files changed drastically

this happens to me also for regular diffs, esp when the PR also contains a refactoring.

I think GitHub had something like this the first time they've stopped rendering large diffs, but they've removed it. It was putting too much load for them to render them.

➡️ This should follow #821, #991 and #1042

Thumbs up on this... in particular it's frustrating that I do a painstaking code review, and the biggest file in the patch gets collapsed like this so that the author doesn't even notice all my comments in there as they leaf through. I'd suggest that diffs with comments be opened/loaded by default!

No default, GitHub hid them because large diffs are heavy on their servers.

+1 for a button at the top to "load all diffs". An additional possible use case is having to search for all occurrences of a particular string/function/etc in the diff, and hiding the large diffs hides some/all of these occurrences.

Anybody knows of any progress regarding this feature?

https://github.com/sindresorhus/refined-github/pull/1042 was dropped because GitHub implemented it natively.

If anyone wants to send a PR, it's probably a matter of:

  • restore+rename the feature
  • replace the selectors

@issuehunt has funded $40.00 to this issue.


I used this snippet in my console to see how well it would perform.

document.querySelectorAll('[aria-label="Display the rich diff"]').forEach(button => {
  button.click();
});

The result... It performed sort of poorly with about ~100 backstop references in one PR loading their diff all at once, but it was certainly a lot faster than clicking all the diff buttons. 😄

Cool! Any way to embed this in a GreaseMonkey/TamperMonkey script?

FWIW I have this issue on my team almost daily (games team) and I wrote some hacky JS to click all the buttons. Just press Ctrl+Shift+I in Chrome (Inspect) and run this in the console:

 var buttons = document.getElementsByClassName('load-diff-button');

 for(var i = 0; i < buttons.length; i++)  
     buttons[i].click();

image

It'll take a bit, but it'll click all of them for ya. No more going crazy clicking buttons.

Excellent, thanks a lot! Will that be activated by default?

It's not a default but you can click on any "Load diff" while holding the alt key, and all the collapsed diffs will be loaded — as long as they appear in the dom at that time (huge PRs may be paginated so you might find more "Load diff"s later)

@sindresorhus has rewarded $36.00 to @notlmn. See it on IssueHunt

  • :moneybag: Total deposit: $40.00
  • :tada: Repository reward(0%): $0.00
  • :wrench: Service fee(10%): $4.00

based on jm991's answer, I made it into a one liner:

Array.from(document.getElementsByClassName('load-diff-button')).map(button => button.click())
Was this page helpful?
0 / 5 - 0 ratings

Related issues

durka picture durka  ·  3Comments

vanniktech picture vanniktech  ·  3Comments

MilesBHuff picture MilesBHuff  ·  3Comments

hkdobrev picture hkdobrev  ·  3Comments

pawelad picture pawelad  ·  3Comments