mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
Fix category and checkbox onChange event handling
This commit is contained in:
parent
e51c3c5c56
commit
37d2d8bedf
@ -56,9 +56,9 @@ const Category: FunctionComponent<CategoryProps> = (
|
||||
setCategoryCheckboxState(CategoryCheckboxValueState.Indeterminate);
|
||||
}
|
||||
|
||||
props.onChange(currentValues);
|
||||
}, [currentValues]);
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
{props.category && (
|
||||
|
@ -39,12 +39,6 @@ const CheckboxElement: FunctionComponent<CategoryProps> = (
|
||||
setValue(props.value || false);
|
||||
}, [props.value]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (props.onChange) {
|
||||
props.onChange(value, props.isIndeterminate);
|
||||
}
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
@ -59,6 +53,11 @@ const CheckboxElement: FunctionComponent<CategoryProps> = (
|
||||
event: React.ChangeEvent<HTMLInputElement>
|
||||
) => {
|
||||
setValue(event.target.checked);
|
||||
|
||||
if (props.onChange) {
|
||||
props.onChange(event.target.checked, props.isIndeterminate);
|
||||
}
|
||||
|
||||
}}
|
||||
ref={checkboxRef}
|
||||
autoFocus={props.autoFocus}
|
||||
|
Loading…
Reference in New Issue
Block a user