ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

fix(angular): nav controller can pop views after leaving tabs outlet

Open sean-perkins opened this issue 1 year ago • 0 comments

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • Some docs updates need to be made in the ionic-docs repo, in a separate PR. See the contributing guide for details.
  • [x] Build (npm run build) was run locally and any changes were pushed
  • [x] Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update (formatting, renaming)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

The Angular routing implementation had a race condition when re-entering a tabs outlet. The router outlet would be activated with both the application root ion-router-outlet as well as the tab's router outlet.

Setting the active view waits for the entering view to finish transitioning. Due to how we deterministically set the top outlet, this would always cause the root router outlet being assigned as the top outlet, even though the tabs router outlet was technically the top outlet.

This results in the navController.pop() attempting to pop a view from the top outlet (the root outlet), which does not have views in the stack to remove.

Issue URL: #18593

What is the new behavior?

The Angular routing implementation now makes use of a linear queue that processes all of the tasks for setting the active outlet. It will wait for the previous task to complete transitioning before advancing to the next outlet's task.

This results in the tabs router outlet being correctly assigned as the top outlet. Now calling navController.pop() will correctly pop the top view from the tab's router outlet.

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Dev-build: 6.2.1-dev.11659037685.1ddec1aa

sean-perkins avatar Jul 28 '22 20:07 sean-perkins