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

feat(router): Add router configuration to resolve navigation promise on error #48910

Closed
wants to merge 1 commit into from

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Feb 2, 2023

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught.

fixes #48902

@atscott atscott added type: bug/fix breaking changes target: major This PR is targeted for the next major release action: global presubmit The PR is in need of a google3 global presubmit labels Feb 2, 2023
@angular-robot angular-robot bot added the detected: breaking change PR contains a commit with a breaking change label Feb 2, 2023
@atscott atscott force-pushed the NavigationErrorRuntimeCode branch 4 times, most recently from 2ab6d32 to 5e377bd Compare February 2, 2023 00:50
@ngbot ngbot bot added this to the Backlog milestone Feb 2, 2023
@atscott atscott force-pushed the NavigationErrorRuntimeCode branch 2 times, most recently from bc43f62 to c993f7a Compare February 2, 2023 18:20
@atscott atscott force-pushed the NavigationErrorRuntimeCode branch 2 times, most recently from f354c4e to 50f7850 Compare August 31, 2023 18:41
@atscott atscott changed the title fix(router): Default error handler no longer rejects the navigation promise feat(router): Add router configuration to resolve navigation promise on error Aug 31, 2023
@angular-robot angular-robot bot added detected: feature PR contains a feature commit and removed detected: breaking change PR contains a commit with a breaking change labels Aug 31, 2023
@atscott atscott added feature Issue that requests a new feature target: minor This PR is targeted for the next minor release and removed breaking changes target: major This PR is targeted for the next major release action: global presubmit The PR is in need of a google3 global presubmit labels Aug 31, 2023
@atscott

This comment was marked as outdated.

@atscott atscott force-pushed the NavigationErrorRuntimeCode branch 2 times, most recently from 931ff6d to d802911 Compare August 31, 2023 19:13
…on error

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught. Updating the default value for
this option should be considered for an upcoming major version.

fixes angular#48902
@atscott atscott marked this pull request as ready for review November 30, 2023 19:54
Comment on lines +721 to +725
// TODO(atscott): consider flipping the default behavior of
// resolveNavigationPromiseOnError to be `resolve(false)` when
// undefined. 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@dylhunn dylhunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed-for: public-api

Copy link
Contributor

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed-for: public-api

@atscott atscott added the action: merge The PR is ready for merge by the caretaker label Dec 1, 2023
@dylhunn
Copy link
Contributor

dylhunn commented Dec 5, 2023

This PR was merged into the repository by commit 50d7916.

@dylhunn dylhunn closed this in 50d7916 Dec 5, 2023
tbondwilkinson pushed a commit to tbondwilkinson/angular that referenced this pull request Dec 6, 2023
…on error (angular#48910)

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught. Updating the default value for
this option should be considered for an upcoming major version.

fixes angular#48902

PR Close angular#48910
@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 Jan 5, 2024
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…on error (angular#48910)

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught. Updating the default value for
this option should be considered for an upcoming major version.

fixes angular#48902

PR Close angular#48910
rlmestre pushed a commit to rlmestre/angular that referenced this pull request Jan 26, 2024
…on error (angular#48910)

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught. Updating the default value for
this option should be considered for an upcoming major version.

fixes angular#48902

PR Close angular#48910
amilamen pushed a commit to amilamen/angular that referenced this pull request Jan 26, 2024
…on error (angular#48910)

With the deprecation of the configurable errorHandler in the Router, there is a missing
use-case to prevent the navigation promise from rejecting on an error. This rejection
results in unhandled promise rejections. This commit allows developers to instruct
the router to instead resolve the navigation promise with 'false', which matches
the behavior of other failed navigations.

Resolving the Promise would be the ideal default behavior. It is rare
that any code handles the navigation Promise at all and even more rare
that the Promise rejection is caught. Updating the default value for
this option should be considered for an upcoming major version.

fixes angular#48902

PR Close angular#48910
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: router detected: feature PR contains a feature commit feature Issue that requests a new feature target: minor This PR is targeted for the next minor release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide way to identify Router navigation errors in the global ErrorHandler
6 participants