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

routerLink does not use state-input on doubleclick #29590

Closed
jonasborsch opened this issue Mar 29, 2019 · 3 comments
Closed

routerLink does not use state-input on doubleclick #29590

jonasborsch opened this issue Mar 29, 2019 · 3 comments

Comments

@jonasborsch
Copy link

🐞 bug report

Affected Package

@angular/router

Is this a regression?

I can't tell if it worked in a previous version.

Description

Hello,

I have a application, where I transfer some data through the routerLinks state-input.
At the NavigationEnd event or with the router.lastSuccessfulNavigation I extract the extras and read out the state.
This works fine when clicking on a link one time. If you click more then one time (e.g. doubleclick) the state will be ignored.

Take a look at the stackblitz, I hope this will make clear whats the problem.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-jabnva?file=src%2Fapp%2Fapp.component.ts

🔥 Exception or Error

there is no exception

🌍 Your Environment

Angular Version:



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 7.3.3
Node: 8.11.3
OS: win32 x64
Angular: 7.2.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.3
@angular-devkit/build-angular     0.13.3
@angular-devkit/build-optimizer   0.13.3
@angular-devkit/build-webpack     0.13.3
@angular-devkit/core              7.3.3
@angular-devkit/schematics        7.3.3
@angular/cdk                      7.3.3
@angular/cli                      7.3.3
@angular/material                 7.3.3
@ngtools/webpack                  7.3.3
@schematics/angular               7.3.3
@schematics/update                0.13.3
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.0

Anything else relevant?
Tested in Chrome 73

@Airblader
Copy link
Contributor

Might be a duplicate of #29389

jasonaden added a commit to jasonaden/angular that referenced this issue 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
Copy link
Contributor

Thanks for the issue. Looks like a duplicate of #29389, so please look there for updates.

jasonaden added a commit to jasonaden/angular that referenced this issue 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 added a commit that referenced this issue 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
jasonaden added a commit that referenced this issue 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 issue 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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants