Skip to content

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

@jasonaden

Description

@jasonaden

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions