1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

add a debounce to remove liquidity slider

This commit is contained in:
Matthias Kretschmann 2020-10-29 12:42:19 +01:00
parent eae81505f6
commit a9550e1331
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -17,6 +17,7 @@ import Button from '../../../atoms/Button'
import { getMaxValuesRemove } from './utils'
import { graphql, useStaticQuery } from 'gatsby'
import PriceUnit from '../../../atoms/Price/PriceUnit'
import debounce from 'lodash.debounce'
const contentQuery = graphql`
query PoolRemoveQuery {
@ -130,7 +131,7 @@ export default function Remove({
useEffect(() => {
if (!ocean || !poolTokens) return
async function getValues() {
const getValues = debounce(async () => {
const amountPoolShares =
(Number(amountPercent) / 100) * Number(poolTokens)
setAmountPoolShares(`${amountPoolShares}`)
@ -151,7 +152,7 @@ export default function Remove({
)
setAmountOcean(amountOcean)
}
}
}, 300)
getValues()
}, [amountPercent, isAdvanced, ocean, poolTokens, poolAddress])