diff --git a/package.json b/package.json index 35cdad5..0d56e84 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.7.26", + "version": "0.7.27", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Bond/components/BondInputArea.jsx b/src/containers/Bond/components/BondInputArea.jsx index 44cde8b..988756f 100644 --- a/src/containers/Bond/components/BondInputArea.jsx +++ b/src/containers/Bond/components/BondInputArea.jsx @@ -1,6 +1,6 @@ import { CheckBoxOutlineBlank, CheckBoxOutlined } from "@mui/icons-material"; import { Box, Checkbox, FormControlLabel, useMediaQuery } from "@mui/material"; -import { useState, useMemo } from "react"; +import { useState, useMemo, useCallback } from "react"; import { useLocation } from "react-router-dom"; import { BOND_DEPOSITORY_ADDRESSES } from "../../../constants/addresses"; @@ -66,7 +66,7 @@ const BondInputArea = ({ refetch(); } - const setMax = () => { + const setMax = useCallback(() => { if (!balance) return; if (bond.capacity.inQuoteToken.lt(bond.maxPayout.inQuoteToken)) { @@ -82,12 +82,12 @@ const BondInputArea = ({ ? bond.maxPayout.inQuoteToken.toString() // Payout is the smallest : balance.toString(), ); - }; + }, [bond, balance]); - const baseTokenString = (bond.maxPayout.inBaseToken.lt(bond.capacity.inBaseToken) + const baseTokenString = useMemo(() => (bond.maxPayout.inBaseToken.lt(bond.capacity.inBaseToken) ? bond.maxPayout.inBaseToken : bond.capacity.inBaseToken - ); + ), [bond]); return ( @@ -103,7 +103,7 @@ const BondInputArea = ({ token={} tokenName={preparedQuoteToken.name} info={formatCurrency(balance, formatDecimals, preparedQuoteToken.name)} - endString={preparedQuoteToken.address && "Max"} + endString="Max" endStringOnClick={setMax} value={amount} onChange={event => setAmount(event.currentTarget.value)}