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

feature(router): Provide a way to coalesce multiple failed guards so only a single redirect is called #24618

Closed
jasonaden opened this issue Jun 21, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jasonaden
Copy link
Contributor

commented Jun 21, 2018

When there are multiple guards they will run async. If only one of them performs a router.navigateByUrl(url), there shouldn't be a problem. However, sometimes there are multiple guards that will perform a redirect and there isn't a good way to determine which is the primary one and which one should run.

We need an API that either allows redirects to be scheduled with priority, then "flushed" using the highest priority one, or we need to cancel other guards when a guard performs a redirect. Another option would be to collect info from all the guards and let the redirect be configured in a single place.

This isn't a very well-defined feature as I think it will take some looking at the current APIs and how the navigation flow works to see what's feasible without introducing wildly breaking changes.

@jasonaden jasonaden self-assigned this Jun 21, 2018

@ngbot ngbot bot added this to the Backlog milestone Jun 21, 2018

@jasonaden jasonaden added jira: sync and removed jira: sync labels Jul 16, 2018

@jasonaden jasonaden changed the title feature(router): Provide a way to coalesce multiple failed guards so only a single redirect is called GST-13 ⁃ feature(router): Provide a way to coalesce multiple failed guards so only a single redirect is called Jul 19, 2018

@jasonaden jasonaden removed the jira: sync label Jul 19, 2018

@jasonaden jasonaden changed the title GST-13 ⁃ feature(router): Provide a way to coalesce multiple failed guards so only a single redirect is called feature(router): Provide a way to coalesce multiple failed guards so only a single redirect is called Jul 26, 2018

jasonaden added a commit to jasonaden/angular that referenced this issue Oct 17, 2018

jasonaden added a commit to jasonaden/angular that referenced this issue Oct 17, 2018

jasonaden added a commit to jasonaden/angular that referenced this issue Oct 17, 2018

@matsko matsko closed this in 4e9f2e5 Oct 31, 2018

sculove added a commit to sculove/angular that referenced this issue Nov 2, 2018

@mohammedzamakhan

This comment has been minimized.

Copy link

commented Dec 11, 2018

Is there a documentation, on how to assign the highest priority redirect?

@jasonaden

This comment has been minimized.

Copy link
Contributor Author

commented Dec 11, 2018

@mohammedzamakhan There's a good article by @nathan-lapinski coming out that describes the behavior (his Medium page can be found here).

It looks like the best documentation we currently have on the prioritization is the tests for the prioritizedGuardValue operator: https://github.com/angular/angular/blob/master/packages/router/test/operators/prioritized_guard_value.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.