fix: additional check for component on destroy (#11488)

fixes #10454
pull/11474/head
Philipp Pracht 7 months ago committed by GitHub
parent fa3e98e8c6
commit 3e1f82b8c4
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

@ -193,7 +193,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();
destroy_effect(this.$$me); destroy_effect(this.$$me);
this.$$c = undefined; this.$$c = undefined;

Loading…
Cancel
Save