fix(core): destroy renderer when replacing styles during HMR#59514
Closed
crisbeto wants to merge 1 commit intoangular:mainfrom
Closed
fix(core): destroy renderer when replacing styles during HMR#59514crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto wants to merge 1 commit intoangular:mainfrom
Conversation
Currently when we swap out the component during HMR, we remove the renderer from the cache, but we never destroy it which means that its styles are still in the DOM. This can cause the old styles to leak into the component after they're replaced. These changes add a `destroy` call to ensure that they're removed.
crisbeto
commented
Jan 14, 2025
| * @param lView View to be recreated. | ||
| */ | ||
| function recreateLView(def: ComponentDef<unknown>, lView: LView<unknown>): void { | ||
| function recreateLView( |
Member
Author
There was a problem hiding this comment.
This change isn't strictly necessary for the fix, but I found it a bit hard to keep up with which def we're dealing with.
clydin
approved these changes
Jan 14, 2025
Contributor
|
This PR was merged into the repository by commit 2ca2587. The changes were merged into the following branches: main, 19.0.x, 19.1.x |
kirjs
pushed a commit
that referenced
this pull request
Jan 14, 2025
Currently when we swap out the component during HMR, we remove the renderer from the cache, but we never destroy it which means that its styles are still in the DOM. This can cause the old styles to leak into the component after they're replaced. These changes add a `destroy` call to ensure that they're removed. PR Close #59514
kirjs
pushed a commit
that referenced
this pull request
Jan 14, 2025
Currently when we swap out the component during HMR, we remove the renderer from the cache, but we never destroy it which means that its styles are still in the DOM. This can cause the old styles to leak into the component after they're replaced. These changes add a `destroy` call to ensure that they're removed. PR Close #59514
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Jan 16, 2025
Rolls back the changes from angular#59514 because they ended up being breaking in 1P. We can revisit the internal fix in a different way. Fixes angular#59558.
pkozlowski-opensource
pushed a commit
that referenced
this pull request
Jan 16, 2025
pkozlowski-opensource
pushed a commit
that referenced
this pull request
Jan 16, 2025
crisbeto
added a commit
to crisbeto/angular
that referenced
this pull request
Jan 16, 2025
These changes aim to resolve the issue that prompted angular#59514. The animations module is a bit tricky for HMR, because it schedules the destruction of its renderer after the currently-running animations are done. If there are no running animations, the renderer gets destroyed next time around. This is a problem, because it means that the styles can stay around for a long time. These changes resolve the issue by: 1. Moving the cleanup of the renderer to after the destruction of the old view. This ensures that the usual clean up flow has been kicked off. 2. Flushing the animations when a component is replaced to ensure that the renderer is cleaned up in a timely manner.
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 16, 2025
#59574) These changes aim to resolve the issue that prompted #59514. The animations module is a bit tricky for HMR, because it schedules the destruction of its renderer after the currently-running animations are done. If there are no running animations, the renderer gets destroyed next time around. This is a problem, because it means that the styles can stay around for a long time. These changes resolve the issue by: 1. Moving the cleanup of the renderer to after the destruction of the old view. This ensures that the usual clean up flow has been kicked off. 2. Flushing the animations when a component is replaced to ensure that the renderer is cleaned up in a timely manner. PR Close #59574
AndrewKushnir
pushed a commit
that referenced
this pull request
Jan 16, 2025
#59574) These changes aim to resolve the issue that prompted #59514. The animations module is a bit tricky for HMR, because it schedules the destruction of its renderer after the currently-running animations are done. If there are no running animations, the renderer gets destroyed next time around. This is a problem, because it means that the styles can stay around for a long time. These changes resolve the issue by: 1. Moving the cleanup of the renderer to after the destruction of the old view. This ensures that the usual clean up flow has been kicked off. 2. Flushing the animations when a component is replaced to ensure that the renderer is cleaned up in a timely manner. PR Close #59574
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
…#59514) Currently when we swap out the component during HMR, we remove the renderer from the cache, but we never destroy it which means that its styles are still in the DOM. This can cause the old styles to leak into the component after they're replaced. These changes add a `destroy` call to ensure that they're removed. PR Close angular#59514
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
Rolls back the changes from angular#59514 because they ended up being breaking in 1P. We can revisit the internal fix in a different way. Fixes angular#59558. PR Close angular#59557
PrajaktaB27
pushed a commit
to PrajaktaB27/angular
that referenced
this pull request
Feb 7, 2025
angular#59574) These changes aim to resolve the issue that prompted angular#59514. The animations module is a bit tricky for HMR, because it schedules the destruction of its renderer after the currently-running animations are done. If there are no running animations, the renderer gets destroyed next time around. This is a problem, because it means that the styles can stay around for a long time. These changes resolve the issue by: 1. Moving the cleanup of the renderer to after the destruction of the old view. This ensures that the usual clean up flow has been kicked off. 2. Flushing the animations when a component is replaced to ensure that the renderer is cleaned up in a timely manner. PR Close angular#59574
|
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.
Currently when we swap out the component during HMR, we remove the renderer from the cache, but we never destroy it which means that its styles are still in the DOM. This can cause the old styles to leak into the component after they're replaced. These changes add a
destroycall to ensure that they're removed.