Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit780ca30

Browse files
fixed input state change not updating temporary state value
1 parentb60860a commit780ca30

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

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

Lines changed: 7 additions & 13 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_,{debounce}from"lodash";
14+
import{fromPairs}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";
@@ -84,7 +84,7 @@ type ValidationParams = {
8484
customRule:string;
8585
};
8686

87-
constvalueInfoMap=_.fromPairs(
87+
constvalueInfoMap=fromPairs(
8888
TextInputValidationOptions.map((option)=>[option.value,option])
8989
);
9090

@@ -216,26 +216,19 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
216216
);
217217
},[props.customRule])
218218

219-
constdebouncedOnChangeRef=useRef(
220-
debounce((value:string)=>{
219+
constonChangeRef=useRef(
220+
(value:string)=>{
221221
props.value.onChange(value);
222-
},1000)
222+
}
223223
);
224224

225-
// Cleanup debounced function on unmount
226-
useEffect(()=>{
227-
return()=>{
228-
debouncedOnChangeRef.current.cancel();
229-
};
230-
},[]);
231-
232225
consthandleChange=(e:ChangeEvent<HTMLInputElement>)=>{
233226
constvalue=e.target.value;
234227
setLocalInputValue(value);
235228

236229
changeRef.current=true;
237230
touchRef.current=true;
238-
debouncedOnChangeRef.current?.(value);
231+
onChangeRef.current?.(value);
239232
};
240233

241234
// Cleanup refs on unmount
@@ -244,6 +237,7 @@ export const useTextInputProps = (props: RecordConstructorToView<typeof textInpu
244237
changeRef.current=false;
245238
touchRef.current=false;
246239
propsRef.current=nullasany;
240+
onChangeRef.current=nullasany;
247241
};
248242
},[]);
249243

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp