From 20fa383649969e31bfbf88f089fd66dc1e737cc0 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Fri, 25 Apr 2025 09:43:22 +1200 Subject: [PATCH] [SDK] Only update isLoggedIn state on successful logins --- .changeset/large-candies-cough.md | 5 +++++ packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/large-candies-cough.md diff --git a/.changeset/large-candies-cough.md b/.changeset/large-candies-cough.md new file mode 100644 index 00000000000..606e3b3bd07 --- /dev/null +++ b/.changeset/large-candies-cough.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Only update isLoggedIn state on successfull logins diff --git a/packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts b/packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts index 4df6dcbd616..c073edf385a 100644 --- a/packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts +++ b/packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts @@ -110,7 +110,7 @@ export function useSiweAuth( return await authOptions.doLogin(signedPayload); }, - onSettled: () => { + onSuccess: () => { return queryClient.invalidateQueries({ queryKey: ["siwe_auth", "isLoggedIn"], }); @@ -126,7 +126,7 @@ export function useSiweAuth( return await authOptions.doLogout(); }, - onSettled: () => { + onSuccess: () => { return queryClient.invalidateQueries({ queryKey: ["siwe_auth", "isLoggedIn"], });