-
Notifications
You must be signed in to change notification settings - Fork 13.5k
bug: Angular Router fix in 11.2.10 breaks expected behavior for ion-router-outlet? #23230
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
Thanks for the issue. I can reproduce this behavior. The problem here is that we attempt to save the route context inside of the tabs router outlet before it gets deactivated: https://github.com/ionic-team/ionic-framework/blob/master/angular/src/directives/navigation/ion-router-outlet.ts#L150 This line just creates a reference to the context object, but does not clone it. We later use that information to determine the correct URL to go back to (I.e. the correct tab): https://github.com/ionic-team/ionic-framework/blob/master/angular/src/directives/navigation/stack-controller.ts#L173-L182 Since we only created a reference to the context object, when Angular Router started clearing the old route information out in v11.2.10, we no longer had access to the route snapshot's URL to return us to the correct tab. I created a patch that does a deep copy of the Can you try the following dev build and let me know if it resolves the issue?
|
@liamdebeasi your temp package seems to solve the issue. |
@liamdebeasi any idea when this fix can be integrated in a stable version? @StavM and I are working on the same project, and we need this fix for our next release. |
@liamdebeasi Yes, your fix takes care of the problem in our app. Thanks so much for the quick work on this! |
Thanks for the issue. This has been resolved via #23238, and a fix will be available in an upcoming release of Ionic Framework. We do not normally give estimates on when fixes will be released, but given the nature of this bug we do plan on making a release this week. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Bug Report
Ionic version:
[x] 5.x
Current behavior:
When using Angular >= 11.2.10 there is a change in the routing behavior due to this bug fix: issue: angular/angular#41379 | fix: atscott/angular@4f94113
With this bug fix, I can no longer navigate to routes parallel to ion-tabs routes and then use the ion-back-button to navigate back to my previous place in ion-tabs. It now always lands on the default tab.
Expected behavior:
Prior to fix, I was able to navigate from ion-tabs to parallel modules and then navigate back to previous location in ion-tabs.
Use case: app with Posts tab and Messages tab - both link to a separate Profile page, and should return to the original tab when "back" is clicked.
Steps to reproduce:
-- Expected Behavior: --
With this repo: https://github.com/joshbowdoin/back-button-test-angular_11.2.9
Navigate from Posts -> @UserHandle (profile page should show) -> click "Back" (should be back on Posts)
Navigate from Messages -> click a conversation -> click @UserHandle (profile page should show) -> click "Back" (should be on previous conversation
-- Broken Behavior: --
With this repo: https://github.com/joshbowdoin/back-button-test-angular_11.2.10
Navigate from Posts -> @UserHandle (profile page should show) -> click "Back" (should be back on Posts)
Navigate from Messages -> click a conversation -> click @UserHandle (profile page should show) -> click "Back" (broken: will now be on Posts instead of previous conversation)
Related code:
These three lines were added in Angular's
deactivateRouteAndOutlet
which destroys my previous context:https://github.com/atscott/angular/blob/4f941133ce6bf551447c56b484a485261ea9bbfe/packages/router/src/operators/activate_routes.ts#L128-L130
Ionic info:
The text was updated successfully, but these errors were encountered: