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

fix(router): handle constructor errors during initial navigation #49953

Closed
wants to merge 1 commit into from

Commits on Apr 20, 2023

  1. fix(router): handle constructor errors during initial navigation

    Currently, when there is an error inside a lazy loaded component constructor an unhandled promise rejection is thrown which causes the error handler not to be invoked on the server due to an issue with Zone.js see angular#49930.
    
    While this is a workaround for that in general we should not cause unhandled promise rejections and always await and catch promises especially going for going zoneless, this is because Node.js does not wait for pending unhandled promises and these will cause the process to exit. See: nodejs/node#22088
    
    Eventually, the framework will need to be updated to better handle  promises in certain listeners for zoneless and avoid unhandled promises
    
    Example on potential problematic code.
    ```ts
    {
        provide: APP_BOOTSTRAP_LISTENER,
        useFactory: () => {
          Promise.resolve().then(() => {})
        },
    }
    ```
    
    This change is also a step closer to address angular#33642
    alan-agius4 committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    21bbaee View commit details
    Browse the repository at this point in the history