-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix: prevent numerous transition/animation memory leaks #12759
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
Conversation
🦋 Changeset detectedLatest commit: 9dbd96a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Do you have a repro that demonstrates the leak on |
packages/svelte/src/internal/client/dom/elements/transitions.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/internal/client/dom/elements/transitions.js
Outdated
Show resolved
Hide resolved
I added the test case in the OP. |
I updated the PR. @Rich-Harris it seems that we don't need to |
Whilst digging into #12719, I discovered several memory leaks where we retain DOM elements longer than we should. We also frustratingly retain the animation even after the DOM element has been detached and the animation is cancelled – but this seems to happen on the MDN site too, so maybe WAAPI has issues on Chromium?
I can't say for sure if this solves all the issues, but it definitely solves a whole load for me and memory usage now doesn't grow at a large rate when toggling the DOM elements in and out in the example.
Test case
If you compare the 2nd and 3rd snapshots, we have no retained DOM elements leaking.