Skip to content

Commit e6393ae

Browse files
authored
chore: filter out ui5 webcomponents in #whenFinished (#425)
1 parent 1f62dda commit e6393ae

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/base/src/RenderScheduler.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,23 @@ class RenderScheduler {
113113
return renderTaskPromise;
114114
}
115115

116+
static getNotDefinedComponents() {
117+
return Array.from(document.querySelectorAll(":not(:defined)")).filter(el => el.localName.startsWith("ui5-"));
118+
}
119+
116120
/**
117121
* return a promise that will be resolved once all ui5 webcomponents on the page have their shadow root ready
118122
*/
119123
static async whenShadowDOMReady() {
120-
const undefinedElements = document.querySelectorAll(":not(:defined)");
124+
const undefinedElements = this.getNotDefinedComponents();
121125

122-
const definedPromises = [...undefinedElements].map(
126+
const definedPromises = undefinedElements.map(
123127
el => customElements.whenDefined(el.localName)
124128
);
125129
const timeoutPromise = new Promise(resolve => setTimeout(resolve, 5000));
126130

127131
await Promise.race([Promise.all(definedPromises), timeoutPromise]);
128-
const stillUndefined = document.querySelectorAll(":not(:defined)");
132+
const stillUndefined = this.getNotDefinedComponents();
129133
if (stillUndefined.length) {
130134
// eslint-disable-next-line
131135
console.warn("undefined elements after 5 seconds: ", [...stillUndefined].map(el => el.localName));

0 commit comments

Comments
 (0)