From 56cf0bae4d7a687010fa5dec6a09294a71b33e47 Mon Sep 17 00:00:00 2001 From: Jure <44338+hoornet@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:14:23 +0100 Subject: [PATCH] Fix multi-account restore and switch after restart - restoreSession pre-loads all nsec accounts from keychain into signer cache at startup, not just the active one - switchAccount updates state to target account on failure instead of leaving UI stuck on previous account - AccountSwitcher shows re-login prompt when account has no signer - store_nsec now logs warnings instead of silently swallowing errors --- src/components/sidebar/AccountSwitcher.tsx | 12 +++- src/stores/user.ts | 66 +++++++++++++++++----- 2 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/components/sidebar/AccountSwitcher.tsx b/src/components/sidebar/AccountSwitcher.tsx index ba42e7b..22effdb 100644 --- a/src/components/sidebar/AccountSwitcher.tsx +++ b/src/components/sidebar/AccountSwitcher.tsx @@ -26,7 +26,7 @@ function Avatar({ account, size = "w-6 h-6", textSize = "text-[10px]" }: { accou } export function AccountSwitcher() { - const { accounts, pubkey, switchAccount, removeAccount, logout } = useUserStore(); + const { accounts, pubkey, loggedIn, switchAccount, removeAccount, logout } = useUserStore(); const { openProfile } = useUIStore(); const [open, setOpen] = useState(false); const [showAddLogin, setShowAddLogin] = useState(false); @@ -137,13 +137,21 @@ export function AccountSwitcher() { {/* Active account row */}
+ {!loggedIn && ( + + )}
openProfile(pubkey)} > - {displayName(current)} + {displayName(current)}