Replies: 1 comment
|
I checked #6830 and it's closed, but not because it got fixed, the underlying limitation is still there in the current The only thing you can hook for that specific case is the native useEffect(() => {
const handler = (e) => {
if (hasUnsavedChanges) {
e.preventDefault();
e.returnValue = ''; // required by Chrome
}
};
window.addEventListener('beforeunload', handler);
return () => window.removeEventListener('beforeunload', handler);
}, [hasUnsavedChanges]);Worth knowing going in: modern browsers ignore any custom message you set (Chrome hasn't shown a custom string in |
Uh oh!
There was an error while loading. Please reload this page.
Specifically the issue related to manual URL changes: #6830
All reactions