Skip to content

Commit 77cfdb3

Browse files
author
John Jenkins
committed
fix(dist-custom-elements): revert #6381
1 parent ccae0d7 commit 77cfdb3

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/runtime/initialize-component.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,7 @@ export const initializeComponent = async (
110110
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
111111
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
112112
// Stencil has completed instantiating the component.
113-
// customElements.whenDefined always returns the answer asynchronously (and slower than a queueMicrotask).
114-
// Checking !!customElements.get(cmpTag) instead is synchronous.
115-
const setWatchIsReady = () => (hostRef.$flags$ |= HOST_FLAGS.isWatchReady);
116-
if (!!customElements.get(cmpTag)) {
117-
setWatchIsReady();
118-
} else {
119-
customElements.whenDefined(cmpTag).then(setWatchIsReady);
120-
}
113+
customElements.whenDefined(cmpTag).then(() => (hostRef.$flags$ |= HOST_FLAGS.isWatchReady));
121114
}
122115

123116
if (BUILD.style && Cstr && Cstr.style) {

0 commit comments

Comments
 (0)