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

fix(router): prevent componentless routes from being detached #44240

Conversation

Carlosamouco
Copy link
Contributor

@Carlosamouco Carlosamouco commented Nov 20, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Currently, when deactivating a route, the detach method of the RouteReuseStrategy is always called
even when we are dealing with a componentless route. If when using a custom strategy we attempt to
detach a componentless route, an exception is thrown causing the navigation to break.

Issue Number: #44239

What is the new behavior?

When deactivating a componentless route, we prevent the detach method of the route reuse strategy from being called.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@google-cla google-cla bot added the cla: yes label Nov 20, 2021
@pullapprove pullapprove bot requested a review from atscott November 20, 2021 23:52
@Carlosamouco Carlosamouco changed the title fix(router): prevent componentless routes from being detached #43791 fix(router): prevent componentless routes from attempting to be detached Nov 20, 2021
@Carlosamouco Carlosamouco changed the title fix(router): prevent componentless routes from attempting to be detached fix(router): prevent componentless routes from being detached Nov 20, 2021
@ngbot ngbot bot added this to the Backlog milestone Nov 22, 2021
Copy link
Contributor

@atscott atscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one request to add a comment about this in the code. Would likely be a good idea to add that to the test description as well.

@atscott
Copy link
Contributor

atscott commented Nov 22, 2021

presubmit

@Carlosamouco Carlosamouco force-pushed the router-reuse-strategy-detach-fix branch from 84e86eb to 6fe7832 Compare November 22, 2021 22:00
Currently, when deactivating a route, the detach method of the RouteReuseStrategy is always called
even when we are dealing with a componentless route. If when using a custom strategy we attempt to
detach a componentless route, an exception is thrown causing the navigation to break.
This change prevents this from happening, by not triggering the detach of the route reuse strategy.

Fixes angular#44239
@Carlosamouco Carlosamouco force-pushed the router-reuse-strategy-detach-fix branch from 6fe7832 to 3e481f8 Compare November 22, 2021 22:49
@atscott atscott added target: patch This PR is targeted for the next patch release action: presubmit The PR is in need of a google3 presubmit labels Nov 22, 2021
@atscott
Copy link
Contributor

atscott commented Nov 23, 2021

green global presubmits

@atscott atscott added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: presubmit The PR is in need of a google3 presubmit labels Nov 23, 2021
@ngbot
Copy link

ngbot bot commented Nov 23, 2021

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: legacy-unit-tests-saucelabs" is failing
    pending status "google3" is pending

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@atscott
Copy link
Contributor

atscott commented Nov 23, 2021

merge assistance: saucelabs failure looks unrelated

@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit f44cb57.

jessicajaniuk pushed a commit that referenced this pull request Nov 23, 2021
Currently, when deactivating a route, the detach method of the RouteReuseStrategy is always called
even when we are dealing with a componentless route. If when using a custom strategy we attempt to
detach a componentless route, an exception is thrown causing the navigation to break.
This change prevents this from happening, by not triggering the detach of the route reuse strategy.

Fixes #44239

PR Close #44240
@sventropy
Copy link

Is there an ETA for 13.0.3 containing this fix?

@atscott
Copy link
Contributor

atscott commented Nov 29, 2021

@sventropy This week Wednesday (Dec. 1)

@Carlosamouco Carlosamouco deleted the router-reuse-strategy-detach-fix branch December 1, 2021 22:21
@Carlosamouco Carlosamouco restored the router-reuse-strategy-detach-fix branch December 1, 2021 22:22
dimakuba pushed a commit to dimakuba/angular that referenced this pull request Dec 28, 2021
…r#44240)

Currently, when deactivating a route, the detach method of the RouteReuseStrategy is always called
even when we are dealing with a componentless route. If when using a custom strategy we attempt to
detach a componentless route, an exception is thrown causing the navigation to break.
This change prevents this from happening, by not triggering the detach of the route reuse strategy.

Fixes angular#44239

PR Close angular#44240
@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 Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: router cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants