New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opting out of beforeunload and using BFCache #31
Comments
Hmm, interesting. What do you think about adding a flag to the var history = createHistory({
useBeforeUnload: false
}); I'd think if you want to disable something like this you'd want to disable it for all transition hooks, so setting the option globally makes sense. As far as listening for the |
Just re-read this. I think you're right. Maybe we make it opt-in instead in that case? var history = createHistory({
useBeforeUnload: true
}); |
Yeah, I'd actually prefer opt-in. Also agree with your reasoning for using an |
Taking a look at this today. I think it makes sense to opt-in to |
I think it would be great to allow opting out of using
beforeunload
for the following reasons:localStorage
to restore it on the next visit rather than annoying the user with a modal when he tries to close the browser window. There's even a discussion about disabling it by default at bugzilla.Incidentally, using
beforeunload
to disable BFCache fixes this bug which occurs when re-entering the cached page at a different URL. But as far as I can tell we can fix this in a better way by using thepageshow
event. Something likeThat way, when using a browser with BFCache, re-entering our app at the same URL wouldn't require any re-renders, and re-entering at a different URL would allow for render optimizations such as React's reconciliation (DOM diffing).
The text was updated successfully, but these errors were encountered: