Skip to content

Commit d2eab5a

Browse files
committed
set onfinish to null to fix a rare bug
1 parent 7c7fd65 commit d2eab5a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,10 @@ function animate(element, options, counterpart, t2, on_finish) {
427427
animation.cancel();
428428
// This prevents memory leaks in Chromium
429429
animation.effect = null;
430+
// This prevents onfinish to be launched after cancel(),
431+
// which can happen in some rare cases
432+
// see https://github.com/sveltejs/svelte/issues/13681
433+
animation.onfinish = null;
430434
}
431435
},
432436
deactivate: () => {

0 commit comments

Comments
 (0)