Please sign in to comment.
fix(ivy): run pre-order hooks in injection order (#34026)
This commit fixes a compatibility bug where pre-order lifecycle hooks (onInit, doCheck, OnChanges) for directives on the same host node were executed based on the order the directives were matched, rather than the order the directives were instantiated (i.e. injection order). This discrepancy can cause issues with forms, where it is common to inject NgControl and try to extract its control property in ngOnInit. As the NgControl directive is injected, it should be instantiated before the control value accessor directive (and thus its hooks should run first). This ensures that the NgControl ngOnInit can set up the form control before the ngOnInit for the control value accessor tries to access it. Closes #32522 PR Close #34026
- Loading branch information
Showing with 384 additions and 45 deletions.
- +1 −1 integration/_payload-limits.json
- +11 −0 packages/core/src/render3/assert.ts
- +0 −1 packages/core/src/render3/component.ts
- +16 −3 packages/core/src/render3/di.ts
- +3 −2 packages/core/src/render3/di_setup.ts
- +1 −19 packages/core/src/render3/hooks.ts
- +19 −13 packages/core/src/render3/instructions/shared.ts
- +1 −1 packages/core/src/render3/query.ts
- +312 −3 packages/core/test/acceptance/lifecycle_spec.ts
- +3 −0 packages/core/test/bundling/hello_world/bundle.golden_symbols.json
- +17 −2 packages/forms/test/value_accessor_integration_spec.ts
Oops, something went wrong.