Forráskód Böngészése

fix: show dashboard if opening editor failed

tophf 3 éve
szülő
commit
f606a9e5f7
1 módosított fájl, 9 hozzáadás és 5 törlés
  1. 9 5
      src/options/index.js

+ 9 - 5
src/options/index.js

@@ -88,11 +88,7 @@ export async function loadData() {
   const [
     { cache, scripts, sync },
     sizes,
-  ] = await Promise.all([
-    sendCmdDirectly('GetData', params, { retry: true }),
-    sendCmdDirectly('GetSizes', params, { retry: true }),
-    options.ready,
-  ]);
+  ] = await requestData(params);
   store.cache = cache;
   scripts.forEach(initScript);
   sizes.forEach((sz, i) => initSize(sz, scripts[i]));
@@ -101,6 +97,14 @@ export async function loadData() {
   store.loading = false;
 }
 
+function requestData(ids) {
+  return Promise.all([
+    sendCmdDirectly('GetData', ids, { retry: true }),
+    sendCmdDirectly('GetSizes', ids, { retry: true }),
+    options.ready,
+  ]).catch(ids ? (() => requestData()) : console.error);
+}
+
 function initMain() {
   store.loading = true;
   loadData();