Fix feature loading on soft navigation between React-based pages#8881
Fix feature loading on soft navigation between React-based pages#8881SunsetTechuila wants to merge 8 commits intorefined-github:mainfrom
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

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