diff --git a/src/defaultStyleCompiler.ts b/src/defaultStyleCompiler.ts index a7ad8f0..ba3f8c2 100644 --- a/src/defaultStyleCompiler.ts +++ b/src/defaultStyleCompiler.ts @@ -579,7 +579,7 @@ export class DefaultStyleCompiler implements StyleCompiler { } if (widgetHandlerClass) { - this.backfillLocalStyles(widgetHandlerClass, localStyles); + await this.backfillLocalStyles(widgetHandlerClass, localStyles); } localStyles = Objects.clone(localStyles); // To drop any object references @@ -715,7 +715,7 @@ export class DefaultStyleCompiler implements StyleCompiler { return css; } - public backfillLocalStyles(handlerClass: any, localStyles: LocalStyles): void { - this.styleService.backfillLocalStyles(handlerClass, localStyles); + public async backfillLocalStyles(handlerClass: any, localStyles: LocalStyles): Promise { + await this.styleService.backfillLocalStyles(handlerClass, localStyles); } } \ No newline at end of file diff --git a/src/styleService.ts b/src/styleService.ts index bc95b33..1c79fbe 100644 --- a/src/styleService.ts +++ b/src/styleService.ts @@ -462,7 +462,12 @@ export class StyleService { }); }); - this.updateStyles(styles); + await new Promise((resolve) => { + setTimeout(async () => { + await this.mergeStyles(styles); + resolve(); + }, 0); + }); } public async backfillStyles(): Promise {