Skip to content

Commit

Permalink
fix: boot sequence (#10042)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev authored Oct 18, 2024
1 parent ed3abfc commit 106373d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1271,20 +1271,22 @@ abstract class UI5Element extends HTMLElement {
* @public
*/
static define(): typeof UI5Element {
this.definePromise = Promise.all([
this.fetchI18nBundles(),
this.fetchCLDR(),
boot(),
this.onDefine(),
]).then(result => {
const defineSequence = async () => {
await boot(); // boot must finish first, because it initializes configuration
const result = await Promise.all([
this.fetchI18nBundles(), // uses configuration
this.fetchCLDR(),
this.onDefine(),
]);
const [i18nBundles] = result;
Object.entries(this.getMetadata().getI18n()).forEach((pair, index) => {
const propertyName = pair[0];
const targetClass = pair[1].target;
(targetClass as Record<string, any>)[propertyName] = i18nBundles[index];
});
this.asyncFinished = true;
});
};
this.definePromise = defineSequence();

const tag = this.getMetadata().getTag();

Expand Down

0 comments on commit 106373d

Please sign in to comment.