Skip to content

Commit

Permalink
- Fixed leak via shared styles
Browse files Browse the repository at this point in the history
  • Loading branch information
lmartorella committed Feb 3, 2025
1 parent 5c34141 commit 0888966
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/elements/src/component-factory-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export class ComponentNgElementStrategy implements NgElementStrategy {
// Reattach the destroyed empty html element to the parent
if (attachInfo) {
const { parent, viewNode, beforeOf } = attachInfo;
// Clear shadow DOM root context before reattaching the destroyed Angular component,
// to fix memory leak through injected global-style
if (viewNode?.shadowRoot) {
viewNode.shadowRoot.innerHTML = "";
}
parent.insertBefore(viewNode, beforeOf);
}
}
Expand Down

0 comments on commit 0888966

Please sign in to comment.