From 1a75cf3e87b25e3b8962f72114fd235a95fd8aff Mon Sep 17 00:00:00 2001 From: Cristina Malin Date: Fri, 20 May 2022 14:37:02 +0200 Subject: [PATCH] Fixed: merge newly added colors into global styles --- src/defaultStyleCompiler.ts | 6 +++--- src/styleService.ts | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) 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 {