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
Support BFCache using the pageshow event #34
Comments
@taurose Would you like to take a stab at this? |
I would, but I'm not sure how to best implement this. When going back to a different page, do we run transition hooks as if the page was never left, or immediately update the location? Should we let the user know that the transition came from pageshow instead of popstate, and should we let him know in case the URL hasn't changed and we don't need to transition? |
From what I understand of the original bug, it seems like In the steps to reproduce that bug, when is |
It fires when you come back to the app, i.e. when hitting the back button. Instead of re-executing the app, we get the pageshow event with everything else being in the state that the app was left. The example I posted there may be a bit confusing since the app isn't really left, but pressing enter on the URL bar has the same effect of creating a new document, reloading HTML&JS etc. This example should be easier to follow. I'm leaning towards treating it like the initial event, too, since it would be confusing to go back to a page and be presented with a dialog about leaving the page I left a long time ago. On the other hand, the initial DOM will reflect the old page, so maybe we should make it distinguishable somehow. |
What would be the use case here? I guess someone might want to preserve that DOM for some reason. I'm trying to imagine maybe a half-filled out form or something, where you'd want to keep data the user had already entered. But then you'd have to pull all of your application state from the DOM... maybe I'm thinking too much about the React paradigm? In any case, I think for now we can just treat it like the initial |
You wouldn't have to do that since javascript state is cached, too. From the app's perspective, the site was never left. That's where
Sounds good. When trying to implement this, I stumbled upon another problem. Firefox doesn't seem to update I can't think of a way to work around this and fix |
What would be your recommendation here, @taurose? I'm sorry I haven't had more time to dig into this myself. |
I don't think it's worth pursuing this:
|
I think I have a use case for this feature: our site is currently part single page apps and part legacy server side HTML. We step our users through what's essentially a multipage form (essentially, This all works great until you get to a BFCache supporting browser such as Safari. Safari ignores the Right now, the only solution to this problem is to manually hooking into the pageshow event, outside of history. It feels and looks terribly hacky. |
Closing due to inactivity. |
We should support BFCache users using the
pageshow
event.See #31 (comment) for more discussion.
The text was updated successfully, but these errors were encountered: