fix: additional check for component on destroy (svelte4) (#11489)

fixes #10454
pull/11491/head
Philipp Pracht 8 months ago committed by GitHub
parent 091912800a
commit 1bab571caa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: check if svelte component exists on custom element destroy

@ -335,7 +335,7 @@ if (typeof HTMLElement === 'function') {
this.$$cn = false; this.$$cn = false;
// In a microtask, because this could be a move within the DOM // In a microtask, because this could be a move within the DOM
Promise.resolve().then(() => { Promise.resolve().then(() => {
if (!this.$$cn) { if (!this.$$cn && this.$$c) {
this.$$c.$destroy(); this.$$c.$destroy();
this.$$c = undefined; this.$$c = undefined;
} }

Loading…
Cancel
Save