Skip to content

Commit 24f233f

Browse files
Fix bug with components that don't have an initial callback function
1 parent 1a1949c commit 24f233f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ journal/
1313
*.zip
1414

1515
.todo.md
16+
17+
build/

library/component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ export const useCallbacks = <
660660
configurable: true,
661661
enumerable: true,
662662
value(...xs: [string, string, string]) {
663-
return maybeCall(() => g.call(this, ...xs))
663+
return maybeCall(() => g && g.call(this, ...xs))
664664
.then(() =>
665665
f(
666666
this,
@@ -792,7 +792,7 @@ export const useTemplate = <
792792
configurable: true,
793793
enumerable: true,
794794
value(this: E) {
795-
return maybeCall(() => _connectedCallback.call(this))
795+
return maybeCall(() => _connectedCallback && _connectedCallback.call(this))
796796
.then(() => maybeCall<HTMLTemplateElement>(f))
797797
.then((template) => {
798798
if (!template) return;

0 commit comments

Comments
 (0)