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:
parent
eae81505f6
commit
a9550e1331
@ -17,6 +17,7 @@ import Button from '../../../atoms/Button'
|
|||||||
import { getMaxValuesRemove } from './utils'
|
import { getMaxValuesRemove } from './utils'
|
||||||
import { graphql, useStaticQuery } from 'gatsby'
|
import { graphql, useStaticQuery } from 'gatsby'
|
||||||
import PriceUnit from '../../../atoms/Price/PriceUnit'
|
import PriceUnit from '../../../atoms/Price/PriceUnit'
|
||||||
|
import debounce from 'lodash.debounce'
|
||||||
|
|
||||||
const contentQuery = graphql`
|
const contentQuery = graphql`
|
||||||
query PoolRemoveQuery {
|
query PoolRemoveQuery {
|
||||||
@ -130,7 +131,7 @@ export default function Remove({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ocean || !poolTokens) return
|
if (!ocean || !poolTokens) return
|
||||||
|
|
||||||
async function getValues() {
|
const getValues = debounce(async () => {
|
||||||
const amountPoolShares =
|
const amountPoolShares =
|
||||||
(Number(amountPercent) / 100) * Number(poolTokens)
|
(Number(amountPercent) / 100) * Number(poolTokens)
|
||||||
setAmountPoolShares(`${amountPoolShares}`)
|
setAmountPoolShares(`${amountPoolShares}`)
|
||||||
@ -151,7 +152,7 @@ export default function Remove({
|
|||||||
)
|
)
|
||||||
setAmountOcean(amountOcean)
|
setAmountOcean(amountOcean)
|
||||||
}
|
}
|
||||||
}
|
}, 300)
|
||||||
getValues()
|
getValues()
|
||||||
}, [amountPercent, isAdvanced, ocean, poolTokens, poolAddress])
|
}, [amountPercent, isAdvanced, ocean, poolTokens, poolAddress])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user