mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: scratchpad: fix load race
This commit is contained in:
1 parent
265b14236a
commit
39e9b4a9cc
2 files changed
+7
-1
No files matched your search
@@ -28,8 +28,13 @@ const loaders = {
|
||||
},
|
||||
};
|
||||
|
||||
let loadPromise = Promise.resolve();
|
||||
|
||||
export async function load(features = ['markdown']) {
|
||||
let s = Date.now();
|
||||
await loadPromise;
|
||||
let resolve;
|
||||
loadPromise = new Promise((r) => { resolve = r; });
|
||||
if (!loaded) {
|
||||
await loaders.i18n();
|
||||
console.log('Loading monaco editor');
|
||||
@@ -60,6 +65,7 @@ export async function load(features = ['markdown']) {
|
||||
}
|
||||
}
|
||||
await res.loadThemePromise;
|
||||
resolve();
|
||||
return { monaco: res.default, registerAction: res.registerAction };
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.40.8",
|
||||
"version": "4.40.9",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user