fix(health): invalidate the dashboard cache whenever entries change
healthCache was only dropped on lock, on save and by the Recompute button. Import, sync, delete, batch ops, duplicate, restore and the master-password rotation all left it in place, so Vault health kept showing a pre-mutation score and listed entries that no longer exist. Invalidate inside loadEntries() — the choke point every mutation path already goes through — instead of one opt-in per caller. Recompute stays lazy: it only runs when the dashboard is next rendered. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1501,6 +1501,13 @@ async function loadEntries() {
|
||||
const r = await api('/entries', { headers: authHeaders() });
|
||||
state.entries = Array.isArray(r) ? r : [];
|
||||
await decryptEntryMeta(state.entries);
|
||||
// The entry list just changed → the health dashboard's decrypted cache
|
||||
// is stale. Invalidating HERE covers every mutation path at once
|
||||
// (import, sync, delete, batch, duplicate, restore, master-pw change)
|
||||
// instead of one opt-in per caller — which is how import and sync were
|
||||
// left showing a pre-import score. Recompute is lazy: it only runs when
|
||||
// the dashboard is actually rendered.
|
||||
if (typeof healthCache !== 'undefined') healthCache = null;
|
||||
} catch (e) {
|
||||
if (e.message === 'Invalid session' || e.message === 'Session expired') {
|
||||
return doLogout();
|
||||
|
||||
Reference in New Issue
Block a user