loadOlm earlier

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/13095/head
Michael Telatynski 2020-04-08 16:08:39 +01:00
parent ee5d39a001
commit 0b032d7434
2 changed files with 8 additions and 6 deletions

View File

@ -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();

View File

@ -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();