salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.64k stars 393 forks source link

[Synthetic shadow] Memory leak when clicking on element #4885

Open nolanlawson opened 1 week ago

nolanlawson commented 1 week ago

When using @lwc/synthetic-shadow, a component rendering a <h1> will leak if that <h1> is clicked. This does not repro if the <h1> is not clicked, and it does not repro if @lwc/synthetic-shadow is not being used.

Minimal repro

Repro steps:

  1. Clone the above commit
  2. pnpm i && pnpm run dev
  3. Open localhost:3000
  4. Click "Add"
  5. Click the "Hello world" <h1>
  6. Click "Remove"
  7. Take a Chrome Memory snapshot in the DevTools
  8. Notice that 10MB is being allocated and <x-app> is leaked

Screenshot 2024-11-18 at 12 20 48 PM

Screenshot 2024-11-18 at 1 03 50 PM

I can also reproduce this in Firefox.

git2gus[bot] commented 6 days ago

This issue has been linked to a new work item: W-17274024