-
Notifications
You must be signed in to change notification settings - Fork 36
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
(HashHistory not supported) Changing URL in browser and clicking confirm doesn't navigate #36
Comments
Hmm, this issue doesn't happen with any of my projects. Try looking at this example code that works: https://codesandbox.io/s/oq5rrjqjx9 |
Thanks for the issue, @mcupito . When you say "Prompt closes and nothing else happens, but the URL stays the same", do you mean that the URL stays at |
Also, it looks like you're passing NavigationPrompt's onConfirm as ConfirmModal's onActionClicked and calling ConfirmModal's this.testActionClick. Would you please share the method this.testActionClick? |
Yes for your first question, @ZacharyRSmith. Also, the What I end up seeing occur is that the URL changes to
|
@mcupito are you using react-router's HashHistory instead of BrowserHistory? unfortunately, NavigationPrompt is not compatible with HashHistory (i think...i haven't tested it). it seems someone else had this issue with HashHistory: #2 (comment) btw, if you look at the code, NavigationPrompt will push or replace, never pop: https://github.com/ZacharyRSmith/react-router-navigation-prompt/blob/master/src/index.js#L115 if you'd like to Pull Request a change that would make NavigationPrompt compatible with HashHistory, that'd be awesome! |
@ZacharyRSmith Yes we are using |
|
When implementing my own router prompt (without this package), I solved this issue by using |
Thanks, @riteshahlawat ! If anyone reading this would like to open a PR that uses history.replace() when using HashHistory, I think I'd merge. Cheers! |
When I change the URL directly in the browser, I am seeing that my page is not actually navigating upon confirm of the action. I've briefly debugged and saw that the
_state.action
isPOP
when this occurs -- unsure if I can manually try to make thisPUSH
and see what happens.Scenario:
On
test.com/x
Type in
test.com/y
Pop-up appears
Click Yes, Leave the Page (onConfirm)
Prompt closes and nothing else happens, but the URL stays the same
I am using React with Redux, along with React Router.
Here's the implementation :
import ConfirmModal from "../Confirm/Modal";
The
ConfirmModal
has a decent amount of code in it, but it doesn't truly do anything except render what was passed in and call the props as actions :Sidenote: I did not implement this code, but noticed this behavior and have since taken over trying to resolve it. I am aware that this implementation doesn't use any fancy comparison of
location
or anything that doesn't ship out of the box, so it could be a lacking implementation.Thanks for your time!
The text was updated successfully, but these errors were encountered: