diff --git a/src/pages/AddLiquidity/index.tsx b/src/pages/AddLiquidity/index.tsx index ab0fbbe0ad..f912da3ff4 100644 --- a/src/pages/AddLiquidity/index.tsx +++ b/src/pages/AddLiquidity/index.tsx @@ -89,6 +89,7 @@ export default function AddLiquidity({ [currencyA, currencyB, baseCurrency] ) + // url params are the source truth, so we have to do this useEffect(() => { setBaseCurrency(currencyA) return () => { @@ -449,7 +450,8 @@ export default function AddLiquidity({ handleRateToggle={() => { onLeftRangeInput('') onRightRangeInput('') - setBaseCurrency(quoteCurrency) + console.log('test') + history.push(`/add/${currencyIdB as string}/${currencyIdA as string}`) }} /> ) : null} @@ -490,7 +492,8 @@ export default function AddLiquidity({ handleRateToggle={() => { onLeftRangeInput('') onRightRangeInput('') - setBaseCurrency(quoteCurrency) + console.log('test') + history.push(`/add/${currencyIdB as string}/${currencyIdA as string}`) }} /> ) : null} diff --git a/src/pages/MigrateV2/MigrateV2Pair.tsx b/src/pages/MigrateV2/MigrateV2Pair.tsx index a43776ec1e..f108f4ae86 100644 --- a/src/pages/MigrateV2/MigrateV2Pair.tsx +++ b/src/pages/MigrateV2/MigrateV2Pair.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useState } from 'react' +import React, { useCallback, useMemo, useState } from 'react' import { Fraction, Price, Token, TokenAmount, WETH9 } from '@uniswap/sdk-core' import { FACTORY_ADDRESS, JSBI } from '@uniswap/v2-sdk' import { Redirect, RouteComponentProps } from 'react-router' @@ -113,7 +113,7 @@ function V2PairMigration({ const theme = useTheme() const pairFactory = useSingleCallResult(pair, 'factory') - const isNotUniswap = pairFactory.result?.[0] !== FACTORY_ADDRESS ?? false + const isNotUniswap = pairFactory.result?.[0] && pairFactory.result[0] !== FACTORY_ADDRESS const deadline = useTransactionDeadline() // custom from users settings const blockTimestamp = useCurrentBlockTimestamp() @@ -163,11 +163,6 @@ function V2PairMigration({ baseToken ) - // reset the initial state, dont need cleanup token always defined - useEffect(() => { - setBaseToken(token0) - }, [baseToken, token0]) - // get value and prices at ticks const { [Bound.LOWER]: tickLower, [Bound.UPPER]: tickUpper } = ticks const { [Bound.LOWER]: priceLower, [Bound.UPPER]: priceUpper } = pricesAtTicks