From 77471bfe13081d60185498c19a79e9c4fb85ca8d Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 16 Nov 2023 10:13:39 +0000 Subject: [PATCH] chore: use const for default obj return to avoid re-renders --- .../src/modules/permit/hooks/usePermitInfo.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/permit/hooks/usePermitInfo.ts b/apps/cowswap-frontend/src/modules/permit/hooks/usePermitInfo.ts index 5ed3fab1ea..636b006b00 100644 --- a/apps/cowswap-frontend/src/modules/permit/hooks/usePermitInfo.ts +++ b/apps/cowswap-frontend/src/modules/permit/hooks/usePermitInfo.ts @@ -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' @@ -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 @@ -94,7 +96,7 @@ export function usePermitInfo(token: Nullish, tradeType: Nullish