From cb3585606a765b0da58b470323be117cab179da3 Mon Sep 17 00:00:00 2001 From: webdev403 Date: Thu, 21 Mar 2024 05:24:04 -0400 Subject: [PATCH] fix hooks for swap --- src/state/swap/hooks.ts | 4 ++-- src/state/swap/v3/hooks.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/state/swap/hooks.ts b/src/state/swap/hooks.ts index d15d5ad..0a413a4 100644 --- a/src/state/swap/hooks.ts +++ b/src/state/swap/hooks.ts @@ -185,9 +185,9 @@ export function useDerivedSwapInfo(): { const { account, chainId } = useActiveWeb3React(); const chainIdToUse = chainId ?? ChainId.MATIC; const parsedQuery = useParsedQueryString(); - const swapType = parsedQuery ? parsedQuery.swapIndex : undefined; + const swapType = parsedQuery?.swapIndex; const swapSlippage = parsedQuery?.slippage - ? (parsedQuery.slippage as string) + ? (parsedQuery?.slippage as string) : undefined; const { diff --git a/src/state/swap/v3/hooks.ts b/src/state/swap/v3/hooks.ts index 0711eae..90b7e6f 100644 --- a/src/state/swap/v3/hooks.ts +++ b/src/state/swap/v3/hooks.ts @@ -250,8 +250,8 @@ export function useDerivedSwapInfo(): { } const parsedQs = useParsedQueryString(); - const swapSlippage = parsedQs.slippage - ? (parsedQs.slippage as string) + const swapSlippage = parsedQs?.slippage + ? (parsedQs?.slippage as string) : undefined; useEffect(() => { const stableCoins = GlobalData.stableCoins[chainIdToUse];