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"], });