forked from matrix/element-web
iterate app load order tweaks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
37ed89c25f
commit
4b6164d823
|
@ -53,12 +53,18 @@ async function start() {
|
||||||
await settled(rageshakePromise); // give rageshake a chance to load/fail
|
await settled(rageshakePromise); // give rageshake a chance to load/fail
|
||||||
|
|
||||||
await loadSkin();
|
await loadSkin();
|
||||||
|
|
||||||
|
// 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.
|
||||||
await loadApp();
|
await loadApp();
|
||||||
}
|
}
|
||||||
start().catch(err => {
|
start().catch(err => {
|
||||||
// try show the error in React
|
// try show the error in React
|
||||||
|
console.log("Show React error page");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
// fall back to showing the error in an alert
|
// fall back to showing the error in an alert
|
||||||
|
console.log("Show fallback error page");
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -121,6 +121,7 @@ export async function loadSkin() {
|
||||||
// Ensure the skin is the very first thing to load for the react-sdk. We don't even want to reference
|
// Ensure the skin is the very first thing to load for the react-sdk. We don't even want to reference
|
||||||
// the SDK until we have to in imports.
|
// the SDK until we have to in imports.
|
||||||
console.log("Loading skin...");
|
console.log("Loading skin...");
|
||||||
|
// load these async so that its code is not executed immediately and we can catch any exceptions
|
||||||
const [sdk, skin] = await Promise.all([
|
const [sdk, skin] = await Promise.all([
|
||||||
import(
|
import(
|
||||||
/* webpackChunkName: "matrix-react-sdk" */
|
/* webpackChunkName: "matrix-react-sdk" */
|
||||||
|
@ -136,15 +137,10 @@ export async function loadSkin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadApp() {
|
export async function loadApp() {
|
||||||
// Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
|
// load app.js async so that its code is not executed immediately and we can catch any exceptions
|
||||||
// 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.
|
|
||||||
const module = await import(
|
const module = await import(
|
||||||
/* webpackChunkName: "riot-web-app" */
|
/* webpackChunkName: "riot-web-app" */
|
||||||
/* webpackPreload: true */
|
/* webpackPreload: true */
|
||||||
"./app");
|
"./app");
|
||||||
await module.loadApp();
|
await module.loadApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw new Error("foobar");
|
|
||||||
window.Map = undefined;
|
|
||||||
|
|
Loading…
Reference in New Issue