fix(health): invalidate the cache when HIBP results change

The dashboard reads its pwned column from state.hibpResults but its cache was computed before the scan finished, so enabling the breach check from the health view showed 0 pwned while the entry cards already carried the flag. Disabling had the mirror problem: results cleared, dashboard still counting them.
This commit is contained in:
r-zakarya
2026-08-01 19:49:07 +01:00
parent 6bee69eb1a
commit e80703d2c4
2 changed files with 14 additions and 0 deletions
+8
View File
@@ -983,6 +983,11 @@ async function hibpCheckAllEntries() {
})());
}
await Promise.all(workers);
// The health dashboard reads its "pwned" column from state.hibpResults, and
// its cache may well have been computed before these results landed — that
// is exactly what happens when HIBP is switched on from the health view
// itself, which then showed 0 pwned while the entry cards showed the flag.
if (typeof healthCache !== 'undefined') healthCache = null;
render();
}
@@ -7718,6 +7723,9 @@ async function init() {
hibpCheckAllEntries();
} else {
state.hibpResults.clear();
// Same reason as after a scan: the dashboard would keep counting
// breaches from results that no longer exist.
if (typeof healthCache !== 'undefined') healthCache = null;
render();
toast('Breach check disabled');
}