Skip to content

Commit

Permalink
fix: don't poll if only spending limit is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacook committed Oct 10, 2023
1 parent 394ff7f commit d00cbb5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hooks/loadables/useLoadRecovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getDelayModifiers, MODULE_PAGE_SIZE } from '@/services/recovery/delay-m
import useAsync from '../useAsync'
import useSafeInfo from '../useSafeInfo'
import { useWeb3ReadOnly } from '../wallets/web3'
import { getSpendingLimitModuleAddress } from '@/services/contracts/spendingLimitContracts'
import type { AsyncResult } from '../useAsync'
import type { RecoveryState } from '@/store/recoverySlice'

Expand All @@ -31,7 +32,14 @@ const useLoadRecovery = (): AsyncResult<RecoveryState> => {
const web3ReadOnly = useWeb3ReadOnly()

const [delayModifiers, delayModifiersError, delayModifiersLoading] = useAsync<Array<Delay>>(() => {
if (!web3ReadOnly || safe.modules?.length === 0) {
if (!web3ReadOnly || !safe.modules || safe.modules.length === 0) {
return
}

const isOnlySpendingLimit =
safe.modules.length === 1 && safe.modules[0].value === getSpendingLimitModuleAddress(safe.chainId)

if (isOnlySpendingLimit) {
return
}

Expand Down

0 comments on commit d00cbb5

Please sign in to comment.