-
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
Fix for #2 (confirmation on browsers back button) #30
Conversation
Proposed fix for ZacharyRSmith#2
I don't think this will work for reasons stated in #2 . I do not think goBack can be supported without memory history |
With this PR it works with browserHistory, however not yet with hashHistory |
Should work for both cases now. BTW: while reading the history docs, I can't find it mentioning that the history.goBack method works only for memoryRouter |
Yes, the history.goBack method does work for memoryRouter, just not well, as illustrated here:
here is the same in pictures: Ie, goBack() is not sufficient when the user goes back by more than 1. Ie, when the user goes back, we need to know how far they are going back, and pass that to go()...but we cannot know how far the user is going back without memoryHistory. However, if you want to adjust this PR so that using goBack happens only when a param is passed to to NavigationPrompt telling it to use goBack, then I'll merge. I just don't want goBack to be the default because of its surprising behavior when the browser tries to go back by more than 1. |
…typings feat: Adding Typescript typings.
Thanks, I understand now. Use case for adding a param to use goBack instead of push method is in mobile app (progressive web app/ webview/ cordova) when it's possible to navigate trough history only one entry back: either by using hardware back button or immersive mode back button. |
Proposed fix for ZacharyRSmith#2
…vigation-prompt into patch-2 # Conflicts: # es/index.js # src/index.js
I've messed my branch really badly after rebase so this PR is superseeded by #39 which contains better description too. Thanks for the screenshots, these were very helpful to understand how you see things. |
This and attempt to fix #2 and revert of af559d2.
Additionally
history.goBack()
executes afterhistory.block
so I've added the timeoutPlease do not merge yet