Skip to content

Commit

Permalink
fix: Don't break in attributeChangedCallback if $$component does …
Browse files Browse the repository at this point in the history
…not exist yet (#8701)

Since the custom element class waits one tick before instantiating the `$$component` field, it's possibly undefined when `attributeChangedCallback` is called.
  • Loading branch information
mimbrown authored Jun 14, 2023
1 parent f580e2e commit 4f10637
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/svelte/src/runtime/internal/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ if (typeof HTMLElement === 'function') {
this.$$props_definition,
'toProp'
);
this.$$component.$set({ [attr]: this.$$data[attr] });
this.$$component?.$set({ [attr]: this.$$data[attr] });
}

disconnectedCallback() {
Expand Down

0 comments on commit 4f10637

Please sign in to comment.