From ef082932abb5691a57b343226d45934b25b80c38 Mon Sep 17 00:00:00 2001 From: apsinghdev Date: Tue, 22 Oct 2024 00:25:52 +0530 Subject: [PATCH] fix: update the default value of Minimum funding amount when value changes --- .../polarkit/src/components/ui/atoms/MoneyInput.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clients/packages/polarkit/src/components/ui/atoms/MoneyInput.tsx b/clients/packages/polarkit/src/components/ui/atoms/MoneyInput.tsx index ee4df77322..66802e406f 100644 --- a/clients/packages/polarkit/src/components/ui/atoms/MoneyInput.tsx +++ b/clients/packages/polarkit/src/components/ui/atoms/MoneyInput.tsx @@ -1,5 +1,5 @@ import { AttachMoneyOutlined } from '@mui/icons-material' -import { ChangeEvent, FocusEvent, useCallback, useState } from 'react' +import { ChangeEvent, FocusEvent, useCallback, useState, useEffect } from 'react' import { twMerge } from 'tailwind-merge' import Input from './Input' @@ -43,6 +43,12 @@ const MoneyInput = (props: Props) => { value ? (value / 100).toFixed(2) : undefined, ) + useEffect(() => { + if (value !== undefined) { + setInternalValue((value / 100).toFixed(2)) + } + }, [value]) + const onChange = useCallback( (e: ChangeEvent) => { if (_onChange) {