Skip to content

Commit

Permalink
fix: Disable execute button for pending transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed May 2, 2024
1 parent 388b6ee commit 0e5fd63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/transactions/ExecuteTxButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useIsPending from '@/hooks/useIsPending'
import type { SyntheticEvent } from 'react'
import { type ReactElement, useContext } from 'react'
import { type TransactionSummary } from '@safe-global/safe-gateway-typescript-sdk'
Expand All @@ -23,11 +24,12 @@ const ExecuteTxButton = ({
const { setTxFlow } = useContext(TxModalContext)
const { safe } = useSafeInfo()
const txNonce = isMultisigExecutionInfo(txSummary.executionInfo) ? txSummary.executionInfo.nonce : undefined
const isPending = useIsPending(txSummary.id)
const { setSelectedTxId } = useContext(ReplaceTxHoverContext)
const safeSDK = useSafeSDK()

const isNext = txNonce !== undefined && txNonce === safe.nonce
const isDisabled = !isNext || !safeSDK
const isDisabled = !isNext || !safeSDK || isPending

const onClick = (e: SyntheticEvent) => {
e.stopPropagation()
Expand Down

0 comments on commit 0e5fd63

Please sign in to comment.