Skip to content

Commit 4f10637

Browse files
authored
fix: Don't break in attributeChangedCallback if $$component does 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.
1 parent f580e2e commit 4f10637

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ if (typeof HTMLElement === 'function') {
287287
this.$$props_definition,
288288
'toProp'
289289
);
290-
this.$$component.$set({ [attr]: this.$$data[attr] });
290+
this.$$component?.$set({ [attr]: this.$$data[attr] });
291291
}
292292

293293
disconnectedCallback() {

0 commit comments

Comments
 (0)