Skip to content

Commit

Permalink
fix: do not crash when user switches eth -> weth in add (Uniswap#1637)
Browse files Browse the repository at this point in the history
* fix: do not crash when user switches eth -> weth in add

* linting error
  • Loading branch information
moodysalem authored May 18, 2021
1 parent adc8429 commit 02ecd72
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/pages/AddLiquidity/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useContext, useMemo, useState, useEffect } from 'react'
import React, { useCallback, useContext, useMemo, useState } from 'react'
import { TransactionResponse } from '@ethersproject/providers'
import { Currency, CurrencyAmount, currencyEquals, Percent } from '@uniswap/sdk-core'
import { WETH9 } from '@uniswap/sdk-core'
Expand Down Expand Up @@ -88,7 +88,7 @@ export default function AddLiquidity({
const currencyB = useCurrency(currencyIdB)

// keep track for UI display purposes of user selected base currency
const [baseCurrency, setBaseCurrency] = useState(currencyA)
const baseCurrency = currencyA
const quoteCurrency = useMemo(
() =>
currencyA && currencyB && baseCurrency
Expand All @@ -99,14 +99,6 @@ export default function AddLiquidity({
[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
const { independentField, typedValue, startPriceTypedValue } = useV3MintState()

Expand Down

0 comments on commit 02ecd72

Please sign in to comment.