forked from matrix/element-web
move config loading into index for parallelism
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
43357fe842
commit
2c5664b76e
|
@ -128,7 +128,7 @@ function onTokenLoginCompleted() {
|
||||||
window.location.href = formatted;
|
window.location.href = formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadApp(fragParams: {}, acceptBrowser: boolean) {
|
export async function loadApp(fragParams: {}, acceptBrowser: boolean, configError: Error) {
|
||||||
// XXX: the way we pass the path to the worker script from webpack via html in body's dataset is a hack
|
// XXX: the way we pass the path to the worker script from webpack via html in body's dataset is a hack
|
||||||
// but alternatives seem to require changing the interface to passing Workers to js-sdk
|
// but alternatives seem to require changing the interface to passing Workers to js-sdk
|
||||||
const vectorIndexeddbWorkerScript = document.body.dataset.vectorIndexeddbWorkerScript;
|
const vectorIndexeddbWorkerScript = document.body.dataset.vectorIndexeddbWorkerScript;
|
||||||
|
@ -146,9 +146,6 @@ export async function loadApp(fragParams: {}, acceptBrowser: boolean) {
|
||||||
|
|
||||||
const platform = PlatformPeg.get();
|
const platform = PlatformPeg.get();
|
||||||
|
|
||||||
// Load the config from the platform
|
|
||||||
const configError = await loadConfig();
|
|
||||||
|
|
||||||
// Load language after loading config.json so that settingsDefaults.language can be applied
|
// Load language after loading config.json so that settingsDefaults.language can be applied
|
||||||
await loadLanguage();
|
await loadLanguage();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ limitations under the License.
|
||||||
// Require common CSS here; this will make webpack process it into bundle.css.
|
// Require common CSS here; this will make webpack process it into bundle.css.
|
||||||
// Our own CSS (which is themed) is imported via separate webpack entry points
|
// Our own CSS (which is themed) is imported via separate webpack entry points
|
||||||
// in webpack.config.js
|
// in webpack.config.js
|
||||||
import {preparePlatform} from "./init";
|
import {loadConfig, preparePlatform} from "./init";
|
||||||
|
|
||||||
require('gfm.css/gfm.css');
|
require('gfm.css/gfm.css');
|
||||||
require('highlight.js/styles/github.css');
|
require('highlight.js/styles/github.css');
|
||||||
|
@ -112,7 +112,8 @@ async function start() {
|
||||||
|
|
||||||
// set the platform for react sdk
|
// set the platform for react sdk
|
||||||
preparePlatform();
|
preparePlatform();
|
||||||
|
// load config requires the platform to be ready
|
||||||
|
const loadConfigPromise = loadConfig();
|
||||||
const loadOlmPromise = loadOlm();
|
const loadOlmPromise = loadOlm();
|
||||||
|
|
||||||
await loadSkin();
|
await loadSkin();
|
||||||
|
@ -125,8 +126,11 @@ async function start() {
|
||||||
// await things starting successfully
|
// await things starting successfully
|
||||||
await loadOlmPromise;
|
await loadOlmPromise;
|
||||||
|
|
||||||
|
|
||||||
|
const configError = await loadConfigPromise;
|
||||||
|
|
||||||
// Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
|
// Finally, load the app. All of the other react-sdk imports are in this file which causes the skinner to
|
||||||
// run on the components.
|
// run on the components.
|
||||||
await loadApp(fragparts.params, acceptBrowser);
|
await loadApp(fragparts.params, acceptBrowser, configError);
|
||||||
}
|
}
|
||||||
start();
|
start();
|
||||||
|
|
|
@ -138,12 +138,12 @@ export async function loadSkin() {
|
||||||
console.log("Skin loaded!");
|
console.log("Skin loaded!");
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function loadApp(fragParams: {}, acceptBrowser: boolean) {
|
export async function loadApp(fragParams: {}, acceptBrowser: boolean, configError: Error) {
|
||||||
// load app.js async so that its code is not executed immediately and we can catch any exceptions
|
// load app.js async so that its code is not executed immediately and we can catch any exceptions
|
||||||
const module = await import(
|
const module = await import(
|
||||||
/* webpackChunkName: "riot-web-app" */
|
/* webpackChunkName: "riot-web-app" */
|
||||||
/* webpackPreload: true */
|
/* webpackPreload: true */
|
||||||
"./app");
|
"./app");
|
||||||
window.matrixChat = ReactDOM.render(await module.loadApp(fragParams, acceptBrowser),
|
window.matrixChat = ReactDOM.render(await module.loadApp(fragParams, acceptBrowser, configError),
|
||||||
document.getElementById('matrixchat'));
|
document.getElementById('matrixchat'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue