Skip to content

Commit 97c0150

Browse files
authored
fix: improved memory profile for transitions/animations (#12796)
* fix: improved memory profile for transitions/animations * put back the catch
1 parent 4aa6059 commit 97c0150

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/thin-papayas-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: improved memory profile for transitions/animations

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,15 @@ function animate(element, options, counterpart, t2, on_finish, on_abort) {
448448

449449
return {
450450
abort: () => {
451-
animation?.cancel();
451+
if (animation) {
452+
animation.cancel();
453+
// This prevents memory leaks in Chromium
454+
animation.effect = null;
455+
}
452456
task?.abort();
453457
on_abort?.();
458+
on_finish = undefined;
459+
on_abort = undefined;
454460
},
455461
deactivate: () => {
456462
on_finish = undefined;

0 commit comments

Comments
 (0)