Skip to content
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

Auxilliary Routes are not properly deactivated #41379

Closed
sueltschi-sbb opened this issue Mar 30, 2021 · 2 comments
Closed

Auxilliary Routes are not properly deactivated #41379

sueltschi-sbb opened this issue Mar 30, 2021 · 2 comments
Labels
area: router P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent router: aux routes router: directives RouterLink, RouterLinkActive, RouterOutlet etc. state: confirmed
Milestone

Comments

@sueltschi-sbb
Copy link

sueltschi-sbb commented Mar 30, 2021

🐞 Auxilliary Routes are not properly deactivated

Affected Package

@angular/router

Description

Given an auxiliary route that is activated in a <router-outlet>,

If we deactivate the outlet and then remove <router-outlet> and add it back to the DOM, the <router-outlet> will be activated with the last active route and is now out of sync with the router.

🔬 Minimal Reproduction

Starting here

  1. Click on "Aux 1234" => the <router-outlet> is activated
  2. Click on "Deactivate Aux" => the <router-outlet> is deactivated
  3. Click twice on "Toggle Outlet" => the <router-outlet> is falsely activated again with the last active route (aux:1234) and out of sync with the browser URL

I expected the <router-outlet> to be deactivated

🌍 Your Environment

Angular Version:


Angular CLI: 11.2.6
Node: 14.15.4
OS: win32 x64

Angular: 11.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.6
@angular-devkit/build-angular   0.1102.6
@angular-devkit/core            11.2.6
@angular-devkit/schematics      11.2.6
@angular/cli                    11.2.6
@schematics/angular             11.2.6
@schematics/update              0.1102.6
rxjs                            6.6.7
typescript                      4.1.5

@atscott atscott added P4 A relatively minor issue that is not relevant to core functions router: aux routes router: directives RouterLink, RouterLinkActive, RouterOutlet etc. state: confirmed area: router labels Mar 30, 2021
@ngbot ngbot bot added this to the Backlog milestone Mar 30, 2021
@atscott atscott added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed P4 A relatively minor issue that is not relevant to core functions labels Mar 30, 2021
atscott added a commit to atscott/angular that referenced this issue Mar 30, 2021
When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to remove this context from the parent `Map`.
If we do not, the parent will hold on to a reference to this deactivated
context and can result in reactivating an outlet that was deactivated by
the previous navigation.

Fixes angular#41379
atscott added a commit to atscott/angular that referenced this issue Mar 30, 2021
When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to remove this context from the parent `Map`.
If we do not, the parent will hold on to a reference to this deactivated
context and can result in reactivating an outlet that was deactivated by
the previous navigation.

Fixes angular#41379
atscott added a commit to atscott/angular that referenced this issue Mar 30, 2021
When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to remove this context from the parent `Map`.
If we do not, the parent will hold on to a reference to this deactivated
context and can result in reactivating an outlet that was deactivated by
the previous navigation.

Fixes angular#41379
atscott added a commit to atscott/angular that referenced this issue Mar 30, 2021
…ating route

When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to clear the stored information about the
route and the associated component.
If we do not, the context will keep these references and can result in
reactivating an outlet that was deactivated by the previous navigation.

Fixes angular#41379
atscott added a commit to atscott/angular that referenced this issue Mar 30, 2021
…ating route

When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to clear the stored information about the
route and the associated component.
If we do not, the context will keep these references and can result in
reactivating an outlet that was deactivated by the previous navigation.

Fixes angular#41379
@zarend zarend closed this as completed in d28a391 Apr 7, 2021
zarend pushed a commit that referenced this issue Apr 7, 2021
…ating route (#41381)

When we deactivate a child route, we deactivate its outlet as well as
its children. We also need to clear the stored information about the
route and the associated component.
If we do not, the context will keep these references and can result in
reactivating an outlet that was deactivated by the previous navigation.

Fixes #41379

PR Close #41381
@joshbowdoin
Copy link

This bug fix broke our ionic app's navigation.... Is there a way to fix this issue without breaking our behavior as described here: ionic-team/ionic-framework#23230?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: router P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent router: aux routes router: directives RouterLink, RouterLinkActive, RouterOutlet etc. state: confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants