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): adjust setting navigationTransition when a new navigatio… #29636

Closed

Conversation

jasonaden
Copy link
Contributor

…n cancels an existing one

Prior to this change, if a navigation was ongoing and a new one came in, the router could get into a state where router.currentNavigation was null even though a navigation was executing. This change moves where we set the currentNavigation value so it's inside a switchMap. This solves the problem because the finally on the switchMap had been setting currentNavigation to null but the new currentNavigation value would have already been set. Essentially this was a timing problem and is resolved with this change.

Fixes #29389 #29590

@jasonaden jasonaden marked this pull request as ready for review April 1, 2019 17:44
@jasonaden jasonaden requested a review from a team as a code owner April 1, 2019 17:44
@jasonaden
Copy link
Contributor Author

Presubmit

@jasonaden jasonaden added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Apr 1, 2019
@ngbot
Copy link

ngbot bot commented Apr 1, 2019

I see that you just added the PR action: merge label, but the following checks are still failing:
    failure status "ci/circleci: lint" is failing
    pending status "ci/angular: size" is pending
    pending status "ci/circleci: aio_preview" is pending
    pending status "ci/circleci: integration_test" is pending
    pending status "ci/circleci: legacy-misc-tests" is pending
    pending status "ci/circleci: legacy-unit-tests-saucelabs" is pending
    pending status "ci/circleci: material-unit-tests" is pending
    pending status "ci/circleci: test" is pending
    pending status "ci/circleci: test_aio" is pending
    pending status "ci/circleci: test_aio_local" is pending
    pending status "ci/circleci: test_aio_local_ivy" is pending
    pending status "ci/circleci: test_aio_tools" is pending
    pending status "ci/circleci: test_docs_examples" is pending
    pending status "ci/circleci: test_docs_examples_ivy" is pending
    pending status "ci/circleci: test_ivy_aot" is pending
    pending status "google3" is pending
    pending missing required status "ci/circleci: publish_snapshot"

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.

@ngbot ngbot bot added this to the needsTriage milestone Apr 1, 2019
…n cancels an existing one

Prior to this change, if a navigation was ongoing and a new one came in, the router could get into a state where `router.currentNavigation` was `null` even though a navigation was executing. This change moves where we set the `currentNavigation` value so it's inside a `switchMap`. This solves the problem because the `finally` on the `switchMap` had been setting `currentNavigation` to `null` but the new `currentNavigation` value would have already been set. Essentially this was a timing problem and is resolved with this change.

Fixes angular#29389 angular#29590
@jasonaden jasonaden force-pushed the fix_29389_double_navigation branch from bcaa84a to 947e341 Compare April 1, 2019 17:49
@jasonaden jasonaden closed this in f9497bf Apr 1, 2019
jasonaden added a commit that referenced this pull request Apr 1, 2019
…n cancels an existing one (#29636)

Prior to this change, if a navigation was ongoing and a new one came in, the router could get into a state where `router.currentNavigation` was `null` even though a navigation was executing. This change moves where we set the `currentNavigation` value so it's inside a `switchMap`. This solves the problem because the `finally` on the `switchMap` had been setting `currentNavigation` to `null` but the new `currentNavigation` value would have already been set. Essentially this was a timing problem and is resolved with this change.

Fixes #29389 #29590

PR Close #29636
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 2019
…n cancels an existing one (angular#29636)

Prior to this change, if a navigation was ongoing and a new one came in, the router could get into a state where `router.currentNavigation` was `null` even though a navigation was executing. This change moves where we set the `currentNavigation` value so it's inside a `switchMap`. This solves the problem because the `finally` on the `switchMap` had been setting `currentNavigation` to `null` but the new `currentNavigation` value would have already been set. Essentially this was a timing problem and is resolved with this change.

Fixes angular#29389 angular#29590

PR Close angular#29636
@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 Sep 14, 2019
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The state passed to router.navigate is lost when doing multiple navigations
3 participants