Skip to content

Commit

Permalink
Fix wallet account might not use newest state
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Aug 30, 2023
1 parent 57db85f commit 604b519
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/services/subsocial/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { SubsocialMutationConfig } from '@/subsocial-query/subsocial/types'
import { useMutation, UseMutationResult } from '@tanstack/react-query'

export function useWalletGetter() {
const address = useMyAccount((state) => state.address ?? '')
const signer = useMyAccount((state) => state.signer)

return async () => ({ address, signer })
return () => ({
address: useMyAccount.getState().address ?? '',
signer: useMyAccount.getState().signer,
})
}

export default function useCommonTxSteps<Data, ReturnValue>(
Expand Down
2 changes: 1 addition & 1 deletion src/subsocial-query/subsocial/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Apis = {
}

export function useSubsocialMutation<Data, Context = undefined>(
getWallet: () => Promise<WalletAccount>,
getWallet: () => Promise<WalletAccount> | WalletAccount,
transactionGenerator: (
data: Data,
apis: Apis
Expand Down

0 comments on commit 604b519

Please sign in to comment.