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:
@@ -213,7 +213,7 @@
|
||||
}
|
||||
|
||||
let cachedVersion = 'loading…';
|
||||
getVersion().then((v) => { cachedVersion = v; });
|
||||
// Populated in init() via Promise.all alongside getRecoveryState.
|
||||
|
||||
function render(state) {
|
||||
const reasonCode = state.reason?.code ?? null;
|
||||
@@ -274,7 +274,13 @@
|
||||
return;
|
||||
}
|
||||
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);
|
||||
} catch (err) {
|
||||
$('hint').textContent = 'Failed to load recovery state: ' + (err && err.message ? err.message : String(err));
|
||||
|
||||
Reference in New Issue
Block a user