Skip to content

Commit 67a363f

Browse files
committed
[SDK] Fix: ConnectEmbed SIWE Revalidation (#5080)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on fixing revalidation issues related to `siwe` authentication in the `ConnectEmbed` component by updating mutation keys to include the `activeAccount` address. ### Detailed summary - Updated `mutationKey` for the `login` mutation to include `activeAccount?.address`. - Updated `mutationKey` for the `logout` mutation to include `activeAccount?.address`. - Added `gcTime`, `placeholderData`, and `refetchOnWindowFocus` options in the hook configuration. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 1cd11a8 commit 67a363f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/tall-melons-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Fix revalidation with siwe auth in ConnectEmbed

packages/thirdweb/src/react/core/hooks/auth/useSiweAuth.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ export function useSiweAuth(
6666
}
6767
return authOptions.isLoggedIn(activeAccount.address);
6868
},
69+
gcTime: 0,
6970
placeholderData: false,
7071
refetchOnWindowFocus: false,
7172
});
7273

7374
const loginMutation = useMutation({
74-
mutationKey: ["siwe_auth", "login"],
75+
mutationKey: ["siwe_auth", "login", activeAccount?.address],
7576
mutationFn: async () => {
7677
if (!authOptions) {
7778
throw new Error("No auth options provided");
@@ -117,7 +118,7 @@ export function useSiweAuth(
117118
});
118119

119120
const logoutMutation = useMutation({
120-
mutationKey: ["siwe_auth", "logout"],
121+
mutationKey: ["siwe_auth", "logout", activeAccount?.address],
121122
mutationFn: async () => {
122123
if (!authOptions) {
123124
throw new Error("No auth options provided");

0 commit comments

Comments
 (0)