diff --git a/src/actions/nostr.ts b/src/actions/nostr.ts index 87d0d86f7..86e24d887 100644 --- a/src/actions/nostr.ts +++ b/src/actions/nostr.ts @@ -27,6 +27,8 @@ function logInNostr(pubkey: string) { secret, })); + dispatch(setNostrPubkey(undefined)); + const { access_token } = dispatch(authLoggedIn(token)); return await dispatch(verifyCredentials(access_token as string)); }; @@ -43,7 +45,7 @@ function nostrExtensionLogIn() { }; } -function setNostrPubkey(pubkey: string) { +function setNostrPubkey(pubkey: string | undefined) { return { type: NOSTR_PUBKEY_SET, pubkey, diff --git a/src/contexts/nostr-context.tsx b/src/contexts/nostr-context.tsx index a652e82c1..92bc9095b 100644 --- a/src/contexts/nostr-context.tsx +++ b/src/contexts/nostr-context.tsx @@ -28,7 +28,7 @@ export const NostrProvider: React.FC = ({ children }) => { const { account } = useOwnAccount(); const url = instance.nostr?.relay; - const accountPubkey = useAppSelector((state) => account?.nostr.pubkey ?? state.meta.pubkey); + const accountPubkey = useAppSelector((state) => state.meta.pubkey ?? account?.nostr.pubkey); const signer = useMemo( () => (accountPubkey ? NKeys.get(accountPubkey) : undefined) ?? window.nostr,