polish(desktop): recovery.html — await version alongside state in init

Eliminates the brief "Version: loading…" flash in the diagnostic block
on first render. Resolves getRecoveryState + getVersion in parallel via
Promise.all so the first render call has both. Drops the redundant
module-load .then() that set cachedVersion before render ran.
This commit is contained in:
Jannis Braun
2026-05-03 12:09:06 +02:00
parent d2a225a4b9
commit d21459129c
+8 -2
View File
@@ -213,7 +213,7 @@
} }
let cachedVersion = 'loading…'; let cachedVersion = 'loading…';
getVersion().then((v) => { cachedVersion = v; }); // Populated in init() via Promise.all alongside getRecoveryState.
function render(state) { function render(state) {
const reasonCode = state.reason?.code ?? null; const reasonCode = state.reason?.code ?? null;
@@ -274,7 +274,13 @@
return; return;
} }
try { try {
const initial = await window.backspace.getRecoveryState(); // Resolve both in parallel so the first render has the version string
// (otherwise the diagnostic block briefly shows "Version: loading…").
const [initial, version] = await Promise.all([
window.backspace.getRecoveryState(),
getVersion(),
]);
cachedVersion = version;
render(initial); render(initial);
} catch (err) { } catch (err) {
$('hint').textContent = 'Failed to load recovery state: ' + (err && err.message ? err.message : String(err)); $('hint').textContent = 'Failed to load recovery state: ' + (err && err.message ? err.message : String(err));