diff --git a/src/vector/app.js b/src/vector/app.js index 836b2ef1..dee663a1 100644 --- a/src/vector/app.js +++ b/src/vector/app.js @@ -40,7 +40,7 @@ import SdkConfig from "matrix-react-sdk/src/SdkConfig"; import {setTheme} from "matrix-react-sdk/src/theme"; import CallHandler from 'matrix-react-sdk/src/CallHandler'; -import {loadConfig, preparePlatform, loadLanguage, loadOlm} from "./init"; +import {loadConfig, preparePlatform, loadLanguage} from "./init"; let lastLocationHashSet = null; @@ -144,8 +144,6 @@ export async function loadApp(fragParams: {}, acceptBrowser: boolean) { window.addEventListener('hashchange', onHashChange); - await loadOlm(); - // set the platform for react sdk preparePlatform(); const platform = PlatformPeg.get(); diff --git a/src/vector/index.ts b/src/vector/index.ts index d844827a..a35f40c7 100644 --- a/src/vector/index.ts +++ b/src/vector/index.ts @@ -81,13 +81,15 @@ function checkBrowserFeatures() { // try in react but fallback to an `alert` async function start() { // load init.ts async so that its code is not executed immediately and we can catch any exceptions - const {rageshakePromise, loadSkin, loadApp} = await import( + const {rageshakePromise, loadOlm, loadSkin, loadApp} = await import( /* webpackChunkName: "init" */ /* webpackPreload: true */ "./init"); await settled(rageshakePromise); // give rageshake a chance to load/fail + const loadOlmPromise = loadOlm(); + const fragparts = parseQsFromFragment(window.location); // don't try to redirect to the native apps if we're @@ -114,9 +116,11 @@ async function start() { acceptBrowser = Boolean(window.localStorage.getItem("mx_accepts_unsupported_browser")); } + // await things starting successfully + await loadOlmPromise; + // Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to - // run on the components. We use `require` here to make sure webpack doesn't optimize this into an async - // import and thus running before the skin can load. + // run on the components. await loadApp(fragparts.params, acceptBrowser); } start();