Skip to content

Commit 7933c41

Browse files
authored
Merge pull request #958 from qxqzx13/dev
fix:(Chart) fix BasicInput component
2 parents 0ba6760 + e222525 commit 7933c41

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

frontend/src/app/components/FormGenerator/Basic/BasicInput.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import { Input } from 'antd';
2020
import useDebouncedFormValue from 'app/hooks/useDebouncedFormValue';
2121
import { ChartStyleConfig } from 'app/types/ChartConfig';
22-
import { FC, memo } from 'react';
22+
import { FC, memo, useCallback } from 'react';
2323
import styled from 'styled-components/macro';
2424
import { ItemLayoutProps } from '../types';
2525
import { itemLayoutComparer } from '../utils';
@@ -38,13 +38,20 @@ const BasicInput: FC<ItemLayoutProps<ChartStyleConfig>> = memo(
3838
onChange,
3939
);
4040

41+
const inputOnChange = useCallback(
42+
e => {
43+
debouncedUpdateValue(e.target.value);
44+
},
45+
[debouncedUpdateValue],
46+
);
47+
4148
return (
4249
<Wrapper label={t(data?.label, true)}>
4350
<Input
4451
{...rest}
4552
{...options}
4653
value={formValue}
47-
onChange={debouncedUpdateValue}
54+
onChange={inputOnChange}
4855
defaultValue={data?.default}
4956
/>
5057
</Wrapper>

0 commit comments

Comments
 (0)