mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Currently we read lifecycle hooks eagerly during `ɵɵdefineComponent`.
The result is that it is not possible to do any sort of meta-programing
such as mixins or adding lifecycle hooks using custom decorators since
any such code executes after `ɵɵdefineComponent` has extracted the
lifecycle hooks from the prototype. Additionally the behavior is
inconsistent between AOT and JIT mode. In JIT mode overriding lifecycle
hooks is possible because the whole `ɵɵdefineComponent` is placed in
getter which is executed lazily. This is because JIT mode must compile a
template which can be specified as `templateURL` and those we are
waiting for its resolution.
- `+` `ɵɵdefineComponent` becomes smaller as it no longer needs to copy
lifecycle hooks from prototype to `ComponentDef`
- `-` `ɵɵNgOnChangesFeature` feature is now always included with the
codebase as it is no longer tree shakable.
Previously we have read lifecycle hooks from prototype in the
`ɵɵdefineComponent` so that lifecycle hook access would be monomorphic.
This decision was made before we had `T*` data structures. By not
reading the lifecycle hooks we are moving the megamorhic read form
`ɵɵdefineComponent` to instructions. However, the reads happen on
`firstTemplatePass` only and are subsequently cached in the `T*` data
structures. The result is that the overall performance should be same
(or slightly better as the intermediate `ComponentDef` has been
removed.)
- [ ] Remove `ɵɵNgOnChangesFeature` from compiler. (It will no longer
be a feature.)
- [ ] Discuss the future of `Features` as they hinder meta-programing.
Fix #30497
PR Close #35464
|
||
|---|---|---|
| .. | ||
| attributes_spec.ts | ||
| bootstrap_spec.ts | ||
| BUILD.bazel | ||
| change_detection_spec.ts | ||
| change_detection_transplanted_view_spec.ts | ||
| common_integration_spec.ts | ||
| component_spec.ts | ||
| content_spec.ts | ||
| copy_definition_feature_spec.ts | ||
| debug_spec.ts | ||
| di_spec.ts | ||
| directive_spec.ts | ||
| discover_utils_spec.ts | ||
| embedded_views_spec.ts | ||
| exports_spec.ts | ||
| host_binding_spec.ts | ||
| i18n_spec.ts | ||
| inherit_definition_feature_spec.ts | ||
| integration_spec.ts | ||
| lifecycle_spec.ts | ||
| listener_spec.ts | ||
| ng_module_spec.ts | ||
| ngdevmode_debug_spec.ts | ||
| outputs_spec.ts | ||
| pipe_spec.ts | ||
| property_binding_spec.ts | ||
| property_interpolation_spec.ts | ||
| providers_spec.ts | ||
| pure_function_spec.ts | ||
| query_spec.ts | ||
| renderer_factory_spec.ts | ||
| router_integration_spec.ts | ||
| styling_spec.ts | ||
| template_ref_spec.ts | ||
| text_spec.ts | ||
| view_container_ref_spec.ts | ||
| view_insertion_spec.ts | ||
| view_ref_spec.ts | ||