Skip to content

Commit

Permalink
fix: refetch signerf
Browse files Browse the repository at this point in the history
  • Loading branch information
moritzkirstein committed Apr 30, 2024
1 parent cdcf9ce commit 384a46f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/Asset/Edit/EditMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Edit({
const { address: accountId } = useAccount()
const { chain } = useNetwork()
const provider = useProvider()
const { data: signer } = useSigner()
const { data: signer, refetch: refetchSigner } = useSigner()
const newAbortController = useAbortController()

const [success, setSuccess] = useState<string>()
Expand All @@ -62,11 +62,19 @@ export default function Edit({
if (isAutomationEnabled && autoWallet?.address) {
setAccountIdToUse(autoWallet.address)
setSignerToUse(autoWallet)
} else {
LoggerInstance.log('[edit] using autoWallet', { autoWallet })
} else if (accountId && signer) {
setAccountIdToUse(accountId)
setSignerToUse(signer)
LoggerInstance.log('[edit] using web3 account', {
accountId,
signer
})
} else {
refetchSigner()
LoggerInstance.log('[edit] refetching signer')
}
}, [isAutomationEnabled, autoWallet, signer, accountId])
}, [isAutomationEnabled, signer, autoWallet, accountId])

useEffect(() => {
if (!asset || !provider) return
Expand Down

0 comments on commit 384a46f

Please sign in to comment.