Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-vans-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

Added optional chaining to prevent console errors upon disconnecting element from the DOM
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ if (typeof HTMLElement === 'function') {
// In a microtask, because this could be a move within the DOM
Promise.resolve().then(() => {
if (!this.$$cn && this.$$c) {
this.$$c.$destroy();
this.$$c?.$destroy();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this would fix it since we're checking if this.$$c is defined in the above if statement

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my, I've bumped into it on some older version when the check was not there yet and didn't realise when creating this one... My bad! Sorry for that, closing!

this.$$me();
this.$$c = undefined;
}
Expand Down