Skip to content

Commit 0789638

Browse files
committed
fix: address regressed memory leak
1 parent 34af670 commit 0789638

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/svelte/src/internal/client/dom/template.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ export function comment() {
245245
*/
246246
export function append(anchor, dom) {
247247
if (hydrating) return;
248+
// We intentionally do not assign the `dom` property of the effect here because it's far too
249+
// late. If we try, we will capture additional DOM elements that we cannot control the lifecycle
250+
// for and will inevitably cause memory leaks. See https://github.com/sveltejs/svelte/pull/11832
248251

249252
anchor.before(/** @type {Node} */ (dom));
250253
}

0 commit comments

Comments
 (0)