Skip to content

Commit

Permalink
fix: query keys for account public hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dalechyn committed Feb 22, 2024
1 parent 5f301a1 commit 6275682
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-trainers-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@abstract-money/react": patch
---

Fix the query key for account public hooks.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type QueryData = QueryFnData
type QueryKey = readonly [
'accountBaseAddresses',
AccountPublicClient | undefined,
AccountId | undefined,
]

type QueryOptions = Omit<
Expand Down Expand Up @@ -46,8 +47,8 @@ export function useAccountBaseAddressesFromApi(
chainName: accountId?.chainName,
})
const queryKey = React.useMemo(
() => ['accountBaseAddresses', accountPublicClient] as const,
[accountPublicClient],
() => ['accountBaseAddresses', accountPublicClient, accountId] as const,
[accountPublicClient, accountId],
)

const enabled = React.useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type QueryData = QueryFnData
type QueryKey = readonly [
'moduleInstantiate2AddressFromApi',
AccountPublicClient | undefined,
AccountId | undefined,
UseModuleInstantiate2AddressFromApiArgs['args'],
]

Expand Down Expand Up @@ -68,8 +69,13 @@ export function useModuleInstantiate2AddressFromApi(
})
const queryKey = React.useMemo(
() =>
['moduleInstantiate2AddressFromApi', accountPublicClient, args] as const,
[accountPublicClient],
[
'moduleInstantiate2AddressFromApi',
accountPublicClient,
accountId,
args,
] as const,
[accountPublicClient, accountId, args],
)

const enabled = React.useMemo(
Expand Down

0 comments on commit 6275682

Please sign in to comment.