Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable execute button for pending transactions #3645

Merged
merged 1 commit into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading