-
Notifications
You must be signed in to change notification settings - Fork 227
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
[fluxible-router] Safari popstate issue causing a handleHistory.js to execute the navigateAction on page load. #349
Comments
@skippykawakami Thanks for reporting. Let me see what's the best way to work around this. We could potentially do something similar as visionmedia/page.js#213. I'll try it it out in safari 8 first. |
@lingyan Here's an alternate solution that avoids having to set a timeout. I'm sure I don't know all the scary edge-cases fluxible-router has to handle, so this approach may be a bad idea, but it seems to prevent this issue when I use it in the project I'm working on. |
@skippykawakami That's a good approach. The only thing is to test out this use case: load page 1 -> click and navigate to page 2 -> browser refresh reload page 2. On the last refresh, check this window.history.state. It might still have The other approach I was gonna try is to extract the Also could you elaborate a little on the "ATS thing" you mentioned? Is your ATS remapping the url to a different path, therefore |
@lingyan Yeah, the ATS mapping we have for our bucketing and dogfooding appends a query param to the url it's requesting for some reason (I believe it's a well thought-out reason, but I'm not sure what it is). I'll check your use case and see what I find. If that really is the case, it might be better if I check for the fluxible=true in the popState event object's state property rather than the history property (actually maybe that's better overall... Surely there's nothing in e.state for a back button that no one actually pressed) |
@skippykawakami Thanks. Saw your PR. I will test it out a bit. In the meanwhile, you can consider letting ATS pass header field to your node server if possible, instead of using query param. That will work around this issue while we test out your PR. |
@lingyan I'll look into that. |
check currentNavigate.externalUrl for url matching to address #349
…fari browser, see issue #349 for more details
…fari browser, see issue #349 for more details
…fari browser, see issue #349 for more details
Closed via #394 |
Safari fires popstate on page load. Ordinarily this shouldn't cause an issue in fluxible-router, but because of how we're doing some ATS things, it ends up executing the navigateAction. Basically in our prod environment,
url
andcurrentUrl
won't match inside_onHistoryChange
, which causes the navigateAction to execute.handleHistory.js
should guard against this.For reference on the Safari issue:
The text was updated successfully, but these errors were encountered: