fix(health): Fix button must not act when the switch was cancelled
Vault health → Fix on entry B while the editor is open and dirty on entry A: the discard prompt appears, Cancel keeps A open — but openEntryForFix carried on regardless. It unmasked A's password to cleartext, selected it, and pulsed the Generate button (the blinking). Wrong entry, and it revealed a password the user never asked to see. openSlideOver was void, so callers couldn't tell a cancelled switch from a successful one. It now returns false when it bails (discard cancelled, entry not found) and true once the panel actually shows the requested entry; openEntryForFix checks it before touching the password field. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3815,9 +3815,9 @@ async function openSlideOver(id, opts) {
|
||||
okText: 'Discard',
|
||||
danger: true,
|
||||
});
|
||||
if (!ok) return;
|
||||
if (!ok) return false; // caller must not act on a panel that didn't switch
|
||||
}
|
||||
if (!isNew && !e) return;
|
||||
if (!isNew && !e) return false;
|
||||
|
||||
// The editor must be visible when it opens: Settings sits ABOVE the
|
||||
// slideover, so a hotkey (Ctrl+Shift+A) fired with Settings open left
|
||||
@@ -4019,6 +4019,10 @@ async function openSlideOver(id, opts) {
|
||||
}
|
||||
|
||||
renderGrid();
|
||||
// true = the panel is now showing `id`. Callers that chain an action on
|
||||
// the opened entry (openEntryForFix) MUST check this — a cancelled
|
||||
// discard prompt leaves the previous entry in place.
|
||||
return true;
|
||||
}
|
||||
|
||||
// "Show history" launcher — placed below the password field for logins,
|
||||
|
||||
Reference in New Issue
Block a user