Expose a hook/callback for obsolete manifest reload #14790
ZipBrandon
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When React Router detects that the route manifest is obsolete, it triggers a full page reload via window.location.reload(). Applications that register beforeunload event listeners (e.g., to protect against accidental navigation with unsaved changes) have no opportunity to programmatically unsubscribe those listeners before the reload is initiated.
This creates a degraded user experience:
React Router detects an obsolete manifest and attempts to reload.
The browser fires beforeunload, which the app is listening to, presenting a "Reload Site?" confirmation dialog.
If the user clicks Cancel, the reload is aborted — but the manifest is still obsolete.
Subsequent client-side navigations now result in 404s for routes that do still exist, because the stale manifest can no longer resolve them.
The app is effectively broken until the user manually refreshes or accepts the reload.
There is currently no way to distinguish a React Router manifest reload from any other unload event, and no hook to run cleanup logic before the reload is triggered.
Improvements
Adding a hook would allow applications to:
Beta Was this translation helpful? Give feedback.
All reactions