Skip to content

Commit

Permalink
fix: polling of recommended nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
schmanu committed Jul 7, 2023
1 parent 471abc0 commit bdd24a1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/tx/SignOrExecuteForm/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ export const useIsExecutionLoop = (): boolean => {
export const useRecommendedNonce = (): number | undefined => {
const { safeAddress, safe } = useSafeInfo()

const [recommendedNonce] = useAsync(() => {
if (!safe.chainId || !safeAddress) return

return getRecommendedNonce(safe.chainId, safeAddress)
}, [safeAddress, safe.chainId, safe.txQueuedTag]) // update when tx queue changes
const [recommendedNonce] = useAsync(
() => {
if (!safe.chainId || !safeAddress) return

return getRecommendedNonce(safe.chainId, safeAddress)
},
[safeAddress, safe.chainId, safe.txQueuedTag], // update when tx queue changes
false, // keep old recommended nonce while refreshing to avoid skeleton
)

return recommendedNonce
}
Expand Down

0 comments on commit bdd24a1

Please sign in to comment.