Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): Allow redirects after an absolute redirect (#51731)
The router currently restricts all further redirects after an absolute redirect. Because there's no documented reason for _why_ this restriction is in place, I'm now deeming this unnecessary. Developers should not be restricted in this manner. Instead, configs that may have caused infinite redirects in the past should be updated to not be infinite. It is confusing to ignore configs with redirects after an absolute redirect occurred because it creates different matching rules depending on the whether an absolute redirect has happened or not. For additional context on why I believe removing this restriction is necessary, #13373 asks for allowing `redirectTo` to be a function. It would make sense to allow this function to return a `UrlTree` like other guards in the Router. When guards in the `Router` return `UrlTree`, they cancel the current navigation and start a new one to re-do the route matching. Since we're already in the router matching part, we don't need to cancel the navigation. However, the restriction on absolute redirects here then creates a weird situation where developers wouldn't see any other redirects if they returned a `UrlTree` as an absolute redirect from `redirectTo`. resolves #39770 BREAKING CHANGE: Absolute redirects no longer prevent further redirects. Route configurations may need to be adjusted to prevent infinite redirects where additional redirects were previously ignored after an absolute redirect occurred. PR Close #51731
- Loading branch information
Showing
5 changed files
with
44 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters