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
When using base tag, react-router and redux-devtools, Uncaught SecurityError: Failed to execute 'pushState' on 'History' occurs #234
Comments
The correct fix here is probably to use That said, we're not going to accept a PR here without tests. |
This also happened to me when trying to replace('/') from React Router onEnter and base="/". |
Looks like conversation has stalled here. |
I'm having this same problem. Was there a solution? |
My solution was taking path from one state |
When base tag is used like "http://localhost:3000/", in addBasename function from useBasename.js
location.basename is set to '/' and location.pathname is also set to '/' if the location.pathname is '/'.
The problem is that when it reverts to the path '/' by redux-devtools with react-router, it uses locationBeforeTransitions object which is the location object from history and the path becomes '//' in finishTransition function from createBrowserHistory.js and it cause an error like below at window.history.pushState(historyState, null, path) in finishTransition function.
Uncaught SecurityError: Failed to execute 'pushState' on 'History': A history state object with URL 'http:' cannot be created in a document with origin 'http://localhost:3000'.
I guess location.pathname should be set '/' only when location.basename is not '/' so that the path in finishTransition function will be '/'.
The text was updated successfully, but these errors were encountered: