Skip to content

Commit

Permalink
fix: update useProfiles when connecting to different account
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges committed Oct 20, 2024
1 parent df128bf commit 6e476a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-fans-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Fix useProfiles not updating when connecting to a different account
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useProfiles(args: {
}): UseQueryResult<Profile[]> {
const wallet = useAdminWallet();
return useQuery({
queryKey: ["profiles", wallet?.id],
queryKey: ["profiles", wallet?.id, wallet?.getAccount()?.address],
enabled: !!wallet && (wallet.id === "inApp" || isEcosystemWallet(wallet)),
queryFn: async () => {
const ecosystem: Ecosystem | undefined =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useProfiles(args: {
}): UseQueryResult<Profile[]> {
const wallet = useAdminWallet();
return useQuery({
queryKey: ["profiles", wallet?.id],
queryKey: ["profiles", wallet?.id, wallet?.getAccount()?.address],

Check warning on line 34 in packages/thirdweb/src/react/web/hooks/wallets/useProfiles.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/hooks/wallets/useProfiles.ts#L34

Added line #L34 was not covered by tests
enabled: !!wallet && (wallet.id === "inApp" || isEcosystemWallet(wallet)),
queryFn: async () => {
const ecosystem: Ecosystem | undefined =
Expand Down

0 comments on commit 6e476a8

Please sign in to comment.