-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Page refresh breaks with Router.HistoryLocation #1026
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
Comments
Same here! |
So we can work around this by specifying the paths explicitely, but routes without the path property set should just work with history api without any workaround right? I would still consider this a bug. |
This is still an issue. |
Im having the same issue. |
"Reading the current state When your page loads, it might have a non-null state object. This can happen, for example, if the page sets a state object (using pushState() or replaceState()) and then the user restarts their browser. When your page reloads, the page will receive an onload event, but no popstate event. However, if you read the history.state property, you'll get back the state object you would have gotten if a popstate had fired. You can read the state of the current history entry without waiting for a popstate event using the history.state property like this: var currentState = history.state;" I was reading this from Mozillas site. Has this been considered? |
I'm going to guess your server isn't configured to work with history location. All urls need to serve the same page. https://rackt.github.io/react-router/#HistoryLocation If you think you have your server configured, then please ask to reopen. |
I was testing with webpack-dev-server. Not sure how this express catch all route applies to that. I'll give it another try. |
For webpack-dev-server you can use the |
Wonderful! Thanks 👍 |
I am having the same issue. "react": "~0.14.3" but i am using gulp in my project. |
@mvnnn This is not related to your build tool like Gulp. Whatever you're using to serve the static files needs to implement the historyApiFallback kind of mechanism. All request that are not targeting files must be served the index.html file. It could be webpack-dev-server, express, nginx, apache... |
I'm using React 0.13.1 with router 0.13.2
When I try to use the HistoryLocation like this:
It works fine, until I hit the page refresh button. Then I get a 404 on the route. I'm only using simple routes atm
The text was updated successfully, but these errors were encountered: