Commit 02ecd727 authored by Moody Salem's avatar Moody Salem Committed by GitHub

fix: do not crash when user switches eth -> weth in add (#1637)

* fix: do not crash when user switches eth -> weth in add

* linting error
parent adc8429b
import React, { useCallback, useContext, useMemo, useState, useEffect } from 'react' import React, { useCallback, useContext, useMemo, useState } from 'react'
import { TransactionResponse } from '@ethersproject/providers' import { TransactionResponse } from '@ethersproject/providers'
import { Currency, CurrencyAmount, currencyEquals, Percent } from '@uniswap/sdk-core' import { Currency, CurrencyAmount, currencyEquals, Percent } from '@uniswap/sdk-core'
import { WETH9 } from '@uniswap/sdk-core' import { WETH9 } from '@uniswap/sdk-core'
...@@ -88,7 +88,7 @@ export default function AddLiquidity({ ...@@ -88,7 +88,7 @@ export default function AddLiquidity({
const currencyB = useCurrency(currencyIdB) const currencyB = useCurrency(currencyIdB)
// keep track for UI display purposes of user selected base currency // keep track for UI display purposes of user selected base currency
const [baseCurrency, setBaseCurrency] = useState(currencyA) const baseCurrency = currencyA
const quoteCurrency = useMemo( const quoteCurrency = useMemo(
() => () =>
currencyA && currencyB && baseCurrency currencyA && currencyB && baseCurrency
...@@ -99,14 +99,6 @@ export default function AddLiquidity({ ...@@ -99,14 +99,6 @@ export default function AddLiquidity({
[currencyA, currencyB, baseCurrency] [currencyA, currencyB, baseCurrency]
) )
// url params are the source truth, so we have to do this
useEffect(() => {
setBaseCurrency(currencyA)
return () => {
setBaseCurrency(undefined)
}
}, [currencyA, currencyB])
// mint state // mint state
const { independentField, typedValue, startPriceTypedValue } = useV3MintState() const { independentField, typedValue, startPriceTypedValue } = useV3MintState()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment