Skip to content

Commit fccccd4

Browse files
committed
this.$$c may be undefined if element was removed from DOM right after attaching
1 parent 0919128 commit fccccd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/svelte/src/runtime/internal/Component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ if (typeof HTMLElement === 'function') {
335335
this.$$cn = false;
336336
// In a microtask, because this could be a move within the DOM
337337
Promise.resolve().then(() => {
338-
if (!this.$$cn) {
338+
if (!this.$$cn && this.$$c) {
339339
this.$$c.$destroy();
340340
this.$$c = undefined;
341341
}

0 commit comments

Comments
 (0)