From aefebc7e8e60dca4f5d81e9f82f4bef866abcba1 Mon Sep 17 00:00:00 2001 From: peterpeterparker Date: Tue, 17 Aug 2021 09:07:48 +0200 Subject: [PATCH] feat: improve app first render --- studio/src/app/app-root.tsx | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/studio/src/app/app-root.tsx b/studio/src/app/app-root.tsx index 0e547a83b..137d7d5b5 100644 --- a/studio/src/app/app-root.tsx +++ b/studio/src/app/app-root.tsx @@ -1,4 +1,4 @@ -import {Build, Component, Element, h, Listen, State} from '@stencil/core'; +import {Component, Element, h, Listen, State} from '@stencil/core'; import {toastController} from '@ionic/core'; @@ -48,19 +48,19 @@ export class AppRoot { this.langService = LangService.getInstance(); } - async componentWillLoad() { - if (Build.isBrowser) { - const promises: Promise[] = [ - this.authService.init(), - this.offlineService.init(), - this.themeService.initDarkModePreference(), - this.colorService.init(), - this.settingsService.init(), - this.langService.init() - ]; - - await Promise.all(promises); - } + componentWillLoad() { + const promises: Promise[] = [ + this.authService.init(), + this.offlineService.init(), + this.themeService.initDarkModePreference(), + this.colorService.init(), + this.settingsService.init(), + this.langService.init() + ]; + + Promise.all(promises).then(() => { + // async componentWillLoad is render blocking and we want to display the app as soon as possible + }); } async componentDidLoad() {