-
Notifications
You must be signed in to change notification settings - Fork 26.3k
HMR-related fixes #59644
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
HMR-related fixes #59644
Conversation
Currently during HMR we swap out the entire module definition (e.g. `MyComp.ɵcmp = newDef`). In standalone components and most module-based ones this works fine, however in some cases (e.g. circular dependencies) the compiler can produce a `setComponentScope` call for a module-based component. This call doesn't make it into the HMR replacement function, because it is defined in the module's file, not the component's. As a result, the dependencies of these components are cleared out upon replacement. A secondary problem is that the `directiveDefs` and `pipeDefs` fields can save references to definitions that later become stale as a result of HMR. These changes resolve both issues by: 1. Performing the replacement by copying the properties from the new definition onto the old one, while keeping it in place. 2. Preserving the initial `directiveDefs`, `pipeDefs` and `setInput`. Fixes angular#59639.
Fixes that we were filtering out the component itself from the set of dependencies when HMR is enabled, breaking self-referencing components. Fixes angular#59632.
…nc animations Fixes that the async animations renderer didn't have the logic to clean up its style cache during HMR. This is identical to angular#59393. Fixes angular#59640.
Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly.
986e851
to
56f301c
Compare
Caretaker note: this is ready to go. For some reason the CI is showing that one review is pending. |
This PR was merged into the repository by commit 67be7d2. The changes were merged into the following branches: main, 19.1.x |
) Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close #59644
Currently during HMR we swap out the entire module definition (e.g. `MyComp.ɵcmp = newDef`). In standalone components and most module-based ones this works fine, however in some cases (e.g. circular dependencies) the compiler can produce a `setComponentScope` call for a module-based component. This call doesn't make it into the HMR replacement function, because it is defined in the module's file, not the component's. As a result, the dependencies of these components are cleared out upon replacement. A secondary problem is that the `directiveDefs` and `pipeDefs` fields can save references to definitions that later become stale as a result of HMR. These changes resolve both issues by: 1. Performing the replacement by copying the properties from the new definition onto the old one, while keeping it in place. 2. Preserving the initial `directiveDefs`, `pipeDefs` and `setInput`. Fixes #59639. PR Close #59644
) Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close #59644
Currently during HMR we swap out the entire module definition (e.g. `MyComp.ɵcmp = newDef`). In standalone components and most module-based ones this works fine, however in some cases (e.g. circular dependencies) the compiler can produce a `setComponentScope` call for a module-based component. This call doesn't make it into the HMR replacement function, because it is defined in the module's file, not the component's. As a result, the dependencies of these components are cleared out upon replacement. A secondary problem is that the `directiveDefs` and `pipeDefs` fields can save references to definitions that later become stale as a result of HMR. These changes resolve both issues by: 1. Performing the replacement by copying the properties from the new definition onto the old one, while keeping it in place. 2. Preserving the initial `directiveDefs`, `pipeDefs` and `setInput`. Fixes angular#59639. PR Close angular#59644
Fixes that we were filtering out the component itself from the set of dependencies when HMR is enabled, breaking self-referencing components. Fixes angular#59632. PR Close angular#59644
…nc animations (angular#59644) Fixes that the async animations renderer didn't have the logic to clean up its style cache during HMR. This is identical to angular#59393. Fixes angular#59640. PR Close angular#59644
…ular#59644) Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close angular#59644
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Includes the following HMR-related fixes:
fix(core): replace metadata in place during HMR
Currently during HMR we swap out the entire module definition (e.g.
MyComp.ɵcmp = newDef
). In standalone components and most module-based ones this works fine, however in some cases (e.g. circular dependencies) the compiler can produce asetComponentScope
call for a module-based component. This call doesn't make it into the HMR replacement function, because it is defined in the module's file, not the component's. As a result, the dependencies of these components are cleared out upon replacement.A secondary problem is that the
directiveDefs
andpipeDefs
fields can save references to definitions that later become stale as a result of HMR.These changes resolve both issues by:
directiveDefs
,pipeDefs
andsetInput
.fix(core): capture self-referencing component during HMR
Fixes that we were filtering out the component itself from the set of dependencies when HMR is enabled, breaking self-referencing components.
fix(platform-browser): clear renderer cache during HMR when using async animations
Fixes that the async animations renderer didn't have the logic to clean up its style cache during HMR. This is identical to #59393.
fix(compiler-cli): extract parenthesized dependencies during HMR
Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly.
Fixes #59640.
Fixes #59632.
Fixes #59639.