-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
Returning False from canDeactivate() causes history to be incorrect. #809
Comments
Is this related to #731 maybe? |
It does seem to be related. I am seeing the same behavior. I am not using
the browser button but rather calling the navigateBack() method on the
router. The end result appears to be the same. My canDeactivate() does fire
more than once using the router navigateBack() until you reach the end of
history, because it seems to remove the last most recent history entry even
though you did not allow navigating to that page. So eventually it just
takes you out of the app. So each time you return false from
canDeactivate() , the page you will eventually get routed to is not the
last page, but the last page - [n number of times you returned false]
…On Thu, Aug 10, 2017 at 8:56 AM, Bill ***@***.***> wrote:
Is this related to #731 <#731>
maybe?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#809 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALioenv4j3TFocQGex48NQ1Scumob7CCks5sWv4UgaJpZM4OkQIc>
.
|
Same behavior is happening with me. |
I am experiencing the same behavior. |
I have the same problem too. |
@EisenbergEffect can be closed as dupe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm submitting a bug report
2.1.1
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
4.5.0
3.10.8
CLI 0.30.1
Browser:
Chrome 59, Edge
Language:
TypeScript 2.3.0
Current behavior:
Create 5 pages (a, b, c, d). Navigate from a => b => c => d. Page d has a canDeactivate() hook and a boolean to mark as dirty and a back button that calls router.navigateBack(). Then do the following.
Expected/desired behavior:
I would expect the user to be navigated to page c. If the user clicks the back button on page d (when in a dirty state) 5 times, the user is taken to the first page, even thought it was still in a dirty state and should be caught by canDeactivate() and remain on page d.
It appears that even though canDeactivate() returns false, it is doing something to the history that removes the previous route each time, removing the valid history routes. I have attached a sample to show behavior
routes.zip
The text was updated successfully, but these errors were encountered: