@@ -131,6 +131,28 @@ async function start() {
131131 preparePlatform ( ) ;
132132 // load config requires the platform to be ready
133133 const loadConfigPromise = loadConfig ( ) ;
134+ await settled ( loadConfigPromise ) ; // wait for it to settle
135+ // keep initialising so that we can show any possible error with as many features (theme, i18n) as possible
136+
137+ // Load language after loading config.json so that settingsDefaults.language can be applied
138+ const loadLanguagePromise = loadLanguage ( ) ;
139+ // as quickly as we possibly can, set a default theme...
140+ const loadThemePromise = loadTheme ( ) ;
141+ const loadSkinPromise = loadSkin ( ) ;
142+
143+ // await things settling so that any errors we have to render have features like i18n running
144+ await settled ( loadSkinPromise ) ;
145+ await settled ( loadThemePromise ) ;
146+ await settled ( loadLanguagePromise ) ;
147+
148+ // ##########################
149+ // error handling begins here
150+ // ##########################
151+ if ( ! acceptBrowser ) {
152+ await new Promise ( resolve => {
153+ // todo
154+ } ) ;
155+ }
134156
135157 try {
136158 // await config here
@@ -146,33 +168,20 @@ async function start() {
146168 return showError ( _t ( "Unable to load config file: please refresh the page to try again." ) ) ;
147169 }
148170
149- // Load language after loading config.json so that settingsDefaults.language can be applied
150- const loadLanguagePromise = loadLanguage ( ) ;
151- // as quickly as we possibly can, set a default theme...
152- const loadThemePromise = loadTheme ( ) ;
153- const loadSkinPromise = loadSkin ( ) ;
154-
171+ // ##################################
172+ // app load critical path starts here
155173 // await things starting successfully
174+ // ##################################
156175 await loadOlmPromise ;
157176 await settled ( loadSkinPromise ) ;
158177 await loadThemePromise ;
159178 await loadLanguagePromise ;
160179
161- if ( ! acceptBrowser ) {
162- await new Promise ( resolve => {
163- // todo
164- } ) ;
165- }
166-
167180 // Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
168181 // run on the components.
169182 await loadApp ( fragparts . params , acceptBrowser ) ;
170183 } catch ( err ) {
171184 console . trace ( err ) ;
172- // check errors in this order:
173- // Browser Compatibility (skippable)
174- // config.json
175- // runtime errors
176185 const { showError } = await import (
177186 /* webpackChunkName: "init" */
178187 /* webpackPreload: true */
@@ -181,6 +190,7 @@ async function start() {
181190 }
182191}
183192start ( ) . catch ( err => {
193+ console . error ( err ) ;
184194 if ( ! acceptBrowser ) {
185195 alert ( "Incompatible browser" ) ;
186196 }
0 commit comments