Repository navigation
Fix feature loading on soft navigation between React-based pages - #8881
SunsetTechuila wants to merge 8 commits into
Conversation
This reverts commit 6880958.
|
| } | ||
| }); | ||
| } while (await oneEvent(document, 'turbo:render')); | ||
| } while (await oneEvent(document, ['turbo:render', 'soft-nav:react-done'])); |
There was a problem hiding this comment.
unlike soft-nav:render, soft-nav:react-done is fired when user navigates the session history too
| document.addEventListener('turbo:before-fetch-request', unloadAll); // Clicks | ||
| document.addEventListener('turbo:visit', unloadAll); // Back/forward button | ||
| document.addEventListener('soft-nav:progress-bar:start', unloadAll); // Soft navigation | ||
| document.addEventListener('soft-nav:start', unloadAll); // Soft navigation |
There was a problem hiding this comment.
This is a bit too early, but other events are fired too late
| document.addEventListener('soft-nav:start', unloadAll); // Soft navigation | ||
| addEventListener('popstate', unloadAll); // History navigation |
There was a problem hiding this comment.
Do you reckon that we can proceed without these two early events or do they cause too much trouble/noise in the console?
What does "firing too early" mean? Does the page break visually?
There was a problem hiding this comment.
What does "firing too early" mean? Does the page break visually?
Here is a demonstration:
refined-github/source/features/rgh-feature-descriptions.tsx
Lines 150 to 152 in 815661e
refined-github/source/features/rgh-feature-descriptions.tsx
Lines 157 to 159 in 815661e
There was a problem hiding this comment.
Now I think why not unload on soft-nav:render? Seems to work well
There was a problem hiding this comment.
Do you reckon that we can proceed without these two early events
We can't. Neither the turbo:before-fetch-request nor the turbo:visit events are fired in the test cases I provided in the PR description
There was a problem hiding this comment.
Now I think why not unload on
soft-nav:render?
I've let this idea marinate in my head, and I think it's too risky
|
I'm planning to release 26.3.14, this PR won't make the cut so don't force yourself to finish it |
|
Current status of this PR:
Next steps:
|
|
Judging by #6554 (comment), this wouldn't be enough, at least for navigations that keep the same layout
It could cover at least some page transitions though, like issue list -> issue |
|
|
Right, but that has always been the issue.
I think this is doesn't happen for just one or two features. Any feature that appends or even alters DOM is going to be affected. We can still try this PR (or #6905 depending on which one has the closest timing) and then address the individual issues as they come up. |

partially _fixes #6554
Test URLs
https://github.com/refined-github/refined-github/issues/new/choose -> https://github.com/refined-github/refined-github/issues/new?template=1_bug_report.yml
https://github.com/refined-github/refined-github/blob/main/source/features/action-used-by-link.tsx -> other file (checkout https://github.com/refined-github/refined-github/tree/rgh-feat-desc)
Screenshot