-
Notifications
You must be signed in to change notification settings - Fork 59
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
pushStateLocationPlugin does not recognize initial url #223
pushStateLocationPlugin does not recognize initial url #223
Comments
in case it's not obvious for somebody, a workaround is to add a |
@christopherthielen Thanks for the heads up! This differs from the hashLocationPlugin behaviour and from previous versions, hence the confusion. So the prerequisite to using pushStateLocationPlugin is having a |
We now fall back to |
(issue moved from
ui-router/react
repo, where it originally surfaced)Seems like, when using
pushStateLocationPlugin
, whatever location user enters into browser address bar gets ignored by router (depending on configuration, this either redirects you to default state, or gets you nowhere at all).Steps to reproduce:
ui-router/react
repoexamples/animating-transitions/index.js
to use pushStateLocationPlugin instead of hashLocationPlugin:cd examples/animating-transitions && npm i && npm start
http://localhost:3000/about
/home
insteadIf you disable initial rule on line 22, you won't even get to
home
state.Using links works as intended.
hashLocationPlugin works as intended.
Latest version where pushStateLocationPlugin actually works seems to be
0.5.5
. Discovered this bug when trying to upgrade to newest@uirouter/react
version===
After some investigation, it looks like the offender is this commit: 0251424 .
In absence of
<base>
tag, it sets baseHref tolocation.href
at the time of router initialization (changed in subsequent commits tolocation.pathname
, but that does not fix the problem in question). This is OK if we use hashLocation, but for pushStateLocation this means, whatever url was originally entered into browser address bar, becomes baseHref.The text was updated successfully, but these errors were encountered: