Skip to content

Commit 6659b12

Browse files
authored
patch: useCallBack dependencies for InputNumberEx (#2)
* Fix proper useCallBack dependencies for InputNumberEx * Fix dependency array for datei nput
1 parent 6afc77d commit 6659b12

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/controls/date.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const DatePickerEx: React.FunctionComponent<React.PropsWithChildren<IProp
4040
timeValue ? timeValue.getMinutes() : 0, 0, 0
4141
);
4242
props.onDateChange(newDate);
43-
}, [timeValue]);
43+
}, [timeValue, props.onDateChange]);
4444

4545
const changeTimeHandler = React.useCallback((newTimeValue: Date): void => {
4646
//update our state

src/controls/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const InputNumberEx: React.FunctionComponent<React.PropsWithChildren<INum
112112
const isValid = props.required ? !isNullOrNaN(asNumber) : isNullOrUndefined(asNumber) || !isNaN(asNumber);
113113
setIsValid(isValid);
114114
props.onChange(isValid ? asNumber : null);
115-
}, [props.allowDecimals]);
115+
}, [props.allowDecimals, props.onChange, props.required]);
116116

117117
const passProps: IProps = { ...props, defaultValue: undefined, value: undefined, onChange: undefined };
118118

0 commit comments

Comments
 (0)