Skip to content

Commit

Permalink
Default for useIsOnlySpendingLimitBeneficiary; refresh on history tag
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Aug 22, 2023
1 parent 437c66e commit 3b8e956
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/common/CheckWallet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/SpendingLimits/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useIsOnlySpendingLimitBeneficiary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useSpendingLimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export const useSafeHasSpendingLimits = (): boolean => {
return safe.modules.some((module) => sameAddress(module.value, moduleAddress))
}

export const useAllSpendingLimits = (): AsyncResult<SpendingLimitState[]> => {
const { safeAddress } = useSafeInfo()
export const useAllSpendingLimits = (autoRefresh = false): AsyncResult<SpendingLimitState[]> => {
const { safe, safeAddress } = useSafeInfo()
const chainId = useChainId()
const provider = useWeb3ReadOnly()
const tokenInfoFromBalances = useAppSelector(selectTokens, isEqual)
Expand All @@ -135,7 +135,7 @@ export const useAllSpendingLimits = (): AsyncResult<SpendingLimitState[]> => {

return getSpendingLimits(provider, safeAddress, chainId, delegates, tokenInfoFromBalances)
},
[provider, delegates, tokenInfoFromBalances, safeAddress, chainId],
[provider, delegates, tokenInfoFromBalances, safeAddress, chainId, autoRefresh ? safe.txHistoryTag : undefined],
false,
)

Expand Down

0 comments on commit 3b8e956

Please sign in to comment.