From 58e4c1b87f1be5fa29964e7c4fa219b62208ea06 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Feb 2026 19:48:17 +0000 Subject: [PATCH] fix: prevent logout from auto-selecting first saved profile After logout, renderSavedProfiles() was unconditionally falling back to the first saved profile when no active profile existed. This made the profile modal appear as if the user switched accounts instead of logging out, requiring a second logout attempt and a page refresh. The fix gates the fallback so it only triggers when an active pubkey IS set but doesn't match any saved entry (a data-inconsistency edge case), not when the active pubkey is null (the normal logged-out state). https://claude.ai/code/session_01Lw3WG8A9Risiqx2uLTZZZH --- js/ui/profileModalController.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index 470338f8..a8322d7c 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -2334,7 +2334,12 @@ export class ProfileModalController { (entry) => this.normalizeHexPubkey(entry.pubkey) === normalizedActive, ); } - if (!activeEntry && savedEntries.length) { + // Only fall back to the first saved profile when an active pubkey IS set + // but doesn't match any saved entry (data-inconsistency edge case). + // When normalizedActive is null the user is logged out — do NOT auto-select + // a profile, otherwise the modal appears as if the user merely switched + // accounts instead of logging out. + if (!activeEntry && normalizedActive && savedEntries.length) { activeEntry = savedEntries[0]; }