Skip to content

Commit d1d4876

Browse files
fix glitching issue in input/textarea comps
1 parent bcd42ac commit d1d4876

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { stringExposingStateControl } from "comps/controls/codeStateControl";
1111
import { LabelControl } from "comps/controls/labelControl";
1212
import { InputLikeStyleType, LabelStyleType, heightCalculator, widthCalculator } from "comps/controls/styleControlConstants";
1313
import { Section, sectionNames, ValueFromOption } from "lowcoder-design";
14-
import _ from "lodash";
14+
import _, { debounce } from "lodash";
1515
import { css } from "styled-components";
1616
import { EMAIL_PATTERN, URL_PATTERN } from "util/stringUtils";
1717
import { MultiBaseComp, RecordConstructorToComp, RecordConstructorToView } from "lowcoder-core";
@@ -209,10 +209,17 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
209209
);
210210
}, [props.customRule])
211211

212+
const debouncedOnChangeRef = useRef(
213+
debounce((value: string) => {
214+
props.value.onChange(value);
215+
changeRef.current = true;
216+
touchRef.current = true;
217+
}, 1000)
218+
);
219+
212220
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
213-
props.value.onChange(e.target.value);
214-
changeRef.current = true;
215-
touchRef.current = true;
221+
const value = e.target.value;
222+
debouncedOnChangeRef.current?.(value);
216223
};
217224

218225
return [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy