You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PR diff: URL query changing constantly due to default-to-rich-diff #2041
A bigger bug here is that the page scrolls down to the file. If that happens all the time we probably have to drop the feature
Not necessarily, what if we make the request to and update the DOM instead of clicking the button. GitHub currently does innerHTML for this I'm assuming we can use <include-fragment> too.
If this is a big issue, then we can drop it (Also saving serve costs for GitHub 😋).
changed the title [-]PR diff: URL query changing constantly[/-][+]PR diff: URL query changing constantly (due to `default-to-rich-diff`)[/+]on Aug 13, 2019
changed the title [-]PR diff: URL query changing constantly (due to `default-to-rich-diff`)[/-][+]Restore `default-to-rich-diff` feature[/+]on Dec 6, 2019
changed the title [-]Restore `default-to-rich-diff` feature[/-][+]PR diff: URL query changing constantly due to `default-to-rich-diff`[/+]on Aug 23, 2021
Activity
notlmn commentedon May 14, 2019
That's probably because of
default-to-rich-difffeature.Just by looking at the code, my assumption is that for deleted
svgfiles GitHub doesn't render a.render-wrapper, causing both the conditions on https://github.com/sindresorhus/refined-github/blob/09d1ab67b8eae588f33d4f8aa31cfeec1f9dac93/source/features/default-to-rich-diff.tsx#L19 to always fail, which in turn causes the interval to keep on clicking the button for every 300 milliseconds.fregante commentedon May 14, 2019
Indeed this needs to skip deleted files. Thanks for the report!
It's kinda weird that GitHub displays the Rich Diff button even if it won't work
notlmn commentedon May 14, 2019
Not having it would me more confusing IMO, having it provides a reason on why the rich diff cannot be rendered.
fregante commentedon May 15, 2019
It can be there, disabled and with a tooltip, like other similar non-working buttons
fregante commentedon May 17, 2019
A bigger bug here is that the page scrolls down to the file. If that happens all the time we probably have to drop the feature
notlmn commentedon May 17, 2019
Not necessarily, what if we make the request to and update the DOM instead of clicking the button. GitHub currently does
innerHTMLfor this I'm assuming we can use<include-fragment>too.If this is a big issue, then we can drop it (Also saving serve costs for GitHub 😋).
fregante commentedon May 17, 2019
Yeah this feature needs to be rewritten or dropped because the scroll jump is seen everywhere. I looked into their code, this is what I found:
Starting from here:
https://github.com/elementary/icons/pull/792/files
The first file loads this:
https://github.com/elementary/icons/diffs/0?base_sha=8333483bdfaf300e175c285bed70203a283c2230&commentable=true&head_user=lainsce&pull_number=792&sha1=8333483bdfaf300e175c285bed70203a283c2230&sha2=50415810f666efb4e03f8710999c08e09d441d46&short_path=0321141
That URL is found in the button's
form. We can load that withfetchDomand inject it. That pages includes the whole loading gif interface that loads this in aniframe:https://render.githubusercontent.com/diff/svg?commit=8333483bdfaf300e175c285bed70203a283c2230&enc_url1=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f656c656d656e746172792f69636f6e732f383333333438336264666166333030653137356332383562656437303230336132383363323233302f616374696f6e732f31362f77696e646f772d636c6f73652e737667&enc_url2=68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f656c656d656e746172792f69636f6e732f353034313538313066363636656662346530336638373130393939633038653039643434316434362f616374696f6e732f31362f77696e646f772d636c6f73652e737667&path=actions%2F16%2Fwindow-close.svg&repository_id=47588124#69c770a3-32de-4dc2-9497-586d7628242b
So for every SVG it's two HTTP requests. I don't think we can skip this intermediary page, but if we could it'd be great.
At the very least, for every SVG we should load the intermediary page and change the button classes.
cc @idasbiste
Temporarily disable `default-to-rich-diff`
[-]PR diff: URL query changing constantly[/-][+]PR diff: URL query changing constantly (due to `default-to-rich-diff`)[/+][-]PR diff: URL query changing constantly (due to `default-to-rich-diff`)[/-][+]Restore `default-to-rich-diff` feature[/+][-]Restore `default-to-rich-diff` feature[/-][+]PR diff: URL query changing constantly due to `default-to-rich-diff`[/+]