forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): Avoid unhandled promise rejections of navigations by def…
…ault This is the most sane thing to do given that applications very rarely handle the promise rejection and, as a result, would get "unhandled promise rejection" console logs. The vast majority of applications would not be affected by this change so omitting a migration seems reasonable. Instead, applications that rely on rejection can specifically opt-in to the old behavior. BREAKING CHANGE: Navigation promises will no longer be rejected when a navigation error occurs. The error is still reported to the error handler and the events as a `NavigationError` but the promise will instead resolve to `false` as with any other failed navigation. This resolves issues that come from unhandled promise rejections, as the navigation promise is rarely used and likely unhandled if it is rejected. Tests or production code that rely on the rejection can opt back in by using setting `resolveNavigationPromiseOnError` to `false` in `RouterModule.forRoot` or `withRouterConfig` of `provideRouter`.
- Loading branch information
Showing
4 changed files
with
58 additions
and
52 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