@@ -21,8 +21,6 @@ limitations under the License.
2121// Require common CSS here; this will make webpack process it into bundle.css.
2222// Our own CSS (which is themed) is imported via separate webpack entry points
2323// in webpack.config.js
24- import { loadConfig , preparePlatform } from "./init" ;
25-
2624require ( 'gfm.css/gfm.css' ) ;
2725require ( 'highlight.js/styles/github.css' ) ;
2826
@@ -83,7 +81,16 @@ function checkBrowserFeatures() {
8381// try in react but fallback to an `alert`
8482async function start ( ) {
8583 // load init.ts async so that its code is not executed immediately and we can catch any exceptions
86- const { rageshakePromise, preparePlatform, loadOlm, loadSkin, loadApp} = await import (
84+ const {
85+ rageshakePromise,
86+ preparePlatform,
87+ loadOlm,
88+ loadConfig,
89+ loadSkin,
90+ loadLanguage,
91+ loadTheme,
92+ loadApp,
93+ } = await import (
8794 /* webpackChunkName: "init" */
8895 /* webpackPreload: true */
8996 "./init" ) ;
@@ -110,11 +117,11 @@ async function start() {
110117 }
111118 }
112119
120+ const loadOlmPromise = loadOlm ( ) ;
113121 // set the platform for react sdk
114122 preparePlatform ( ) ;
115123 // load config requires the platform to be ready
116124 const loadConfigPromise = loadConfig ( ) ;
117- const loadOlmPromise = loadOlm ( ) ;
118125
119126 await loadSkin ( ) ;
120127
@@ -123,11 +130,17 @@ async function start() {
123130 acceptBrowser = Boolean ( window . localStorage . getItem ( "mx_accepts_unsupported_browser" ) ) ;
124131 }
125132
133+ // await config here
134+ const configError = await loadConfigPromise ;
135+ // Load language after loading config.json so that settingsDefaults.language can be applied
136+ const loadLanguagePromise = loadLanguage ( ) ;
137+ // as quickly as we possibly can, set a default theme...
138+ const loadThemePromise = loadTheme ( ) ;
139+
126140 // await things starting successfully
127141 await loadOlmPromise ;
128-
129-
130- const configError = await loadConfigPromise ;
142+ await loadThemePromise ;
143+ await loadLanguagePromise ;
131144
132145 // Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
133146 // run on the components.
0 commit comments