You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To mimic what users are used, es-router redirects (e.g. when the router is in strict mode) should use the replaceState method, not pushState.
To give an example if why this would be, let's say your base URL is '/foo' and you have route '/bar' added to the router. With pushState and the router in strict mode, if someone visits '/foo/banana', their browser will be sent back to '/foo' automatically because '/banana' isn't a valid route. '/foo' will be pushed to the history. So the history will go from this: ['/foo/banana']
to this: ['/foo/banana', '/foo']
If they try to press the back button, the router is going to detect that change and think they're trying to go back to the second to last item in the history, which is '/foo/banana', and simply push '/foo' into the history again, which will permanently break the back button for the current window (user won't be able to go back to the site they were at before the site using the router).
If replaceState was used instead, a redirect would make the history would go from this: ['/foo/banana']
to this: ['/foo']
which would allow the user to go back to the site they were previously at before visiting the site using the es-router
The text was updated successfully, but these errors were encountered:
I'll actually work on this along with the other changes I made in my pull request, just putting down the idea now so I don't forget. This should be able to fix all the issues for good :)
To mimic what users are used, es-router redirects (e.g. when the router is in strict mode) should use the
replaceState
method, notpushState
.To give an example if why this would be, let's say your base URL is
'/foo'
and you have route'/bar'
added to the router. WithpushState
and the router in strict mode, if someone visits'/foo/banana'
, their browser will be sent back to'/foo'
automatically because'/banana'
isn't a valid route.'/foo'
will be pushed to the history. So the history will go from this:['/foo/banana']
to this:
['/foo/banana', '/foo']
If they try to press the back button, the router is going to detect that change and think they're trying to go back to the second to last item in the history, which is
'/foo/banana'
, and simply push'/foo'
into the history again, which will permanently break the back button for the current window (user won't be able to go back to the site they were at before the site using the router).If
replaceState
was used instead, a redirect would make the history would go from this:['/foo/banana']
to this:
['/foo']
which would allow the user to go back to the site they were previously at before visiting the site using the es-router
The text was updated successfully, but these errors were encountered: