Closed
Conversation
clydin
approved these changes
Jan 21, 2025
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
AndrewKushnir
approved these changes
Jan 21, 2025
Member
Author
|
Caretaker note: this is ready to go. For some reason the CI is showing that one review is pending. |
Contributor
|
This PR was merged into the repository by commit 67be7d2. The changes were merged into the following branches: main, 19.1.x |
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
) Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close #59644
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
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
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 21, 2025
) Fixes that the HMR dependency extraction logic wasn't accounting for parenthesized identifiers correctly. PR Close #59644
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
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
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
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
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…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
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…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. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asetComponentScopecall 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
directiveDefsandpipeDefsfields can save references to definitions that later become stale as a result of HMR.These changes resolve both issues by:
directiveDefs,pipeDefsandsetInput.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.