@@ -11,7 +11,7 @@ import { stringExposingStateControl } from "comps/controls/codeStateControl";
1111import { LabelControl } from "comps/controls/labelControl" ;
1212import { InputLikeStyleType , LabelStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
1313import { Section , sectionNames , ValueFromOption } from "lowcoder-design" ;
14- import _ from "lodash" ;
14+ import _ , { debounce } from "lodash" ;
1515import { css } from "styled-components" ;
1616import { EMAIL_PATTERN , URL_PATTERN } from "util/stringUtils" ;
1717import { 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