-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…52455) The `afterRender` hooks currently run after `ApplicationRef.tick` but also run after any call to `ChangeDetectorRef.detectChanges`. This is problematic because code which uses `afterRender` cannot expect the component it's registered from to be rendered when the callback executes. If there is a call to `ChangeDetectorRef.detectChanges` before the global change detection, that will cause the hooks to run earlier than expected. This behavior is somewhat of a blocker for the zoneless project. There is plenty of application code that do things like `setTimeout(() => doSomethingThatExpectsComponentToBeRendered())`, `NgZone.onStable(() => ...)` or `ApplicationRef.onStable...`. `ApplicationRef.onStable` is a should likely work similarly, but all of these are really wanting an API that is `afterRender` with the requirement that the hook runs after the global render, not an individual CDRef instance. This change updates the `afterRender` hooks to only run when `ApplicationRef.tick` happens. fixes #52429 fixes #53232 PR Close #52455
- Loading branch information
Showing
10 changed files
with
233 additions
and
218 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
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
Oops, something went wrong.