diff --git a/src/components/common/CheckWallet/index.tsx b/src/components/common/CheckWallet/index.tsx index 88490e450d..214e09d813 100644 --- a/src/components/common/CheckWallet/index.tsx +++ b/src/components/common/CheckWallet/index.tsx @@ -20,7 +20,7 @@ enum Message { const CheckWallet = ({ children, allowSpendingLimit, allowNonOwner }: CheckWalletProps): ReactElement => { const wallet = useWallet() const isSafeOwner = useIsSafeOwner() - const isSpendingLimit = useIsOnlySpendingLimitBeneficiary(allowSpendingLimit) + const isSpendingLimit = useIsOnlySpendingLimitBeneficiary(allowSpendingLimit || false) const connectWallet = useConnectWallet() const message = !wallet diff --git a/src/components/settings/SpendingLimits/index.tsx b/src/components/settings/SpendingLimits/index.tsx index d5bca9b732..b48e12fc80 100644 --- a/src/components/settings/SpendingLimits/index.tsx +++ b/src/components/settings/SpendingLimits/index.tsx @@ -13,7 +13,7 @@ import useAllSpendingLimits from '@/hooks/useSpendingLimits' const SpendingLimits = () => { const { setTxFlow } = useContext(TxModalContext) - const [spendingLimits, , spendingLimitsLoading] = useAllSpendingLimits() + const [spendingLimits, , spendingLimitsLoading] = useAllSpendingLimits(true) const isEnabled = useHasFeature(FEATURES.SPENDING_LIMIT) return ( diff --git a/src/hooks/useIsOnlySpendingLimitBeneficiary.tsx b/src/hooks/useIsOnlySpendingLimitBeneficiary.tsx index bd8de2acf7..e0c96b31c9 100644 --- a/src/hooks/useIsOnlySpendingLimitBeneficiary.tsx +++ b/src/hooks/useIsOnlySpendingLimitBeneficiary.tsx @@ -2,7 +2,7 @@ import useWallet from '@/hooks/wallets/useWallet' import useIsSafeOwner from '@/hooks/useIsSafeOwner' import { useSafeHasSpendingLimits, useSpendingLimitDelegates } from './useSpendingLimits' -const useIsOnlySpendingLimitBeneficiary = (allow = false): boolean => { +const useIsOnlySpendingLimitBeneficiary = (allow = true): boolean => { const hasSpendingLimits = useSafeHasSpendingLimits() const wallet = useWallet() const isSafeOwner = useIsSafeOwner() diff --git a/src/hooks/useSpendingLimits.ts b/src/hooks/useSpendingLimits.ts index 81c56eb760..d6f820f8a1 100644 --- a/src/hooks/useSpendingLimits.ts +++ b/src/hooks/useSpendingLimits.ts @@ -121,8 +121,8 @@ export const useSafeHasSpendingLimits = (): boolean => { return safe.modules.some((module) => sameAddress(module.value, moduleAddress)) } -export const useAllSpendingLimits = (): AsyncResult => { - const { safeAddress } = useSafeInfo() +export const useAllSpendingLimits = (autoRefresh = false): AsyncResult => { + const { safe, safeAddress } = useSafeInfo() const chainId = useChainId() const provider = useWeb3ReadOnly() const tokenInfoFromBalances = useAppSelector(selectTokens, isEqual) @@ -135,7 +135,7 @@ export const useAllSpendingLimits = (): AsyncResult => { return getSpendingLimits(provider, safeAddress, chainId, delegates, tokenInfoFromBalances) }, - [provider, delegates, tokenInfoFromBalances, safeAddress, chainId], + [provider, delegates, tokenInfoFromBalances, safeAddress, chainId, autoRefresh ? safe.txHistoryTag : undefined], false, )