Skip to content

Commit

Permalink
fix fill amount
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhoaidanh committed Oct 19, 2023
1 parent 2894ce5 commit 9d7a46d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/components/swapv2/LimitOrder/LimitOrderForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,15 @@ const LimitOrderForm = forwardRef<LimitOrderFormHandle, Props>(function LimitOrd
const notify = useNotify()
const { mixpanelHandler } = useMixpanel()

const { setCurrencyIn, setCurrencyOut, switchCurrency, removeOrderNeedCreated, resetState, setOrderEditing } =
useLimitActionHandlers()
const {
setCurrencyIn,
setCurrencyOut,
switchCurrency,
removeOrderNeedCreated,
resetState,
setOrderEditing,
setInputValue,
} = useLimitActionHandlers()
const { ordersNeedCreated, inputAmount: inputAmountGlobal } = useLimitState()

const [inputAmount, setInputAmount] = useState(defaultInputAmount)
Expand Down Expand Up @@ -526,8 +533,11 @@ const LimitOrderForm = forwardRef<LimitOrderFormHandle, Props>(function LimitOrd
}, [account, chainId, ordersNeedCreated, removeOrderNeedCreated, refreshActiveMakingAmount, isEdit])

useEffect(() => {
if (inputAmountGlobal) onSetInput(inputAmountGlobal)
}, [inputAmountGlobal, onSetInput]) // when redux state change, ex: type and swap
if (inputAmountGlobal) {
onSetInput(inputAmountGlobal)
setInputValue('')
}
}, [inputAmountGlobal, onSetInput, setInputValue]) // when redux state change, ex: type and swap

useEffect(() => {
return () => {
Expand Down

0 comments on commit 9d7a46d

Please sign in to comment.