Skip to content

Commit

Permalink
chore: use const for default obj return to avoid re-renders
Browse files Browse the repository at this point in the history
  • Loading branch information
alfetopito committed Nov 17, 2023
1 parent 4b25698 commit 77471bf
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useMemo } from 'react'
import { GP_VAULT_RELAYER } from '@cowprotocol/common-const'
import { getIsNativeToken, getWrappedToken } from '@cowprotocol/common-utils'
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { getTokenPermitInfo } from '@cowprotocol/permit-utils'
import { getTokenPermitInfo, PermitInfo } from '@cowprotocol/permit-utils'
import { useWalletInfo } from '@cowprotocol/wallet'
import { Currency } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
Expand All @@ -21,6 +21,8 @@ import { ORDER_TYPE_SUPPORTS_PERMIT } from '../const'
import { addPermitInfoForTokenAtom, permittableTokensAtom } from '../state/permittableTokensAtom'
import { IsTokenPermittableResult } from '../types'

const UNSUPPORTED: PermitInfo = { type: 'unsupported', name: 'native' }

/**
* Check whether the token is permittable, and returns the permit info for it
* Tries to find it out from the pre-generated list
Expand Down Expand Up @@ -94,7 +96,7 @@ export function usePermitInfo(token: Nullish<Currency>, tradeType: Nullish<Trade
])

if (isNative) {
return { type: 'unsupported' }
return UNSUPPORTED
}

return preGeneratedInfo ?? permitInfo
Expand Down

0 comments on commit 77471bf

Please sign in to comment.