@@ -11,7 +11,7 @@ import { stringExposingStateControl } from "comps/controls/codeStateControl";
11
11
import { LabelControl } from "comps/controls/labelControl" ;
12
12
import { InputLikeStyleType , LabelStyleType , heightCalculator , widthCalculator } from "comps/controls/styleControlConstants" ;
13
13
import { Section , sectionNames , ValueFromOption } from "lowcoder-design" ;
14
- import _ , { debounce } from "lodash" ;
14
+ import { fromPairs } from "lodash" ;
15
15
import { css } from "styled-components" ;
16
16
import { EMAIL_PATTERN , URL_PATTERN } from "util/stringUtils" ;
17
17
import { MultiBaseComp , RecordConstructorToComp , RecordConstructorToView } from "lowcoder-core" ;
@@ -84,7 +84,7 @@ type ValidationParams = {
84
84
customRule : string ;
85
85
} ;
86
86
87
- const valueInfoMap = _ . fromPairs (
87
+ const valueInfoMap = fromPairs (
88
88
TextInputValidationOptions . map ( ( option ) => [ option . value , option ] )
89
89
) ;
90
90
@@ -216,26 +216,19 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
216
216
) ;
217
217
} , [ props . customRule ] )
218
218
219
- const debouncedOnChangeRef = useRef (
220
- debounce ( ( value : string ) => {
219
+ const onChangeRef = useRef (
220
+ ( value : string ) => {
221
221
props . value . onChange ( value ) ;
222
- } , 1000 )
222
+ }
223
223
) ;
224
224
225
- // Cleanup debounced function on unmount
226
- useEffect ( ( ) => {
227
- return ( ) => {
228
- debouncedOnChangeRef . current . cancel ( ) ;
229
- } ;
230
- } , [ ] ) ;
231
-
232
225
const handleChange = ( e : ChangeEvent < HTMLInputElement > ) => {
233
226
const value = e . target . value ;
234
227
setLocalInputValue ( value ) ;
235
228
236
229
changeRef . current = true ;
237
230
touchRef . current = true ;
238
- debouncedOnChangeRef . current ?.( value ) ;
231
+ onChangeRef . current ?.( value ) ;
239
232
} ;
240
233
241
234
// Cleanup refs on unmount
@@ -244,6 +237,7 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
244
237
changeRef . current = false ;
245
238
touchRef . current = false ;
246
239
propsRef . current = null as any ;
240
+ onChangeRef . current = null as any ;
247
241
} ;
248
242
} , [ ] ) ;
249
243
0 commit comments