Skip to content

Commit 8a57a0c

Browse files
committed
Fix FilterLiveForm
1 parent 22d7e09 commit 8a57a0c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/ra-core/src/form/FilterLiveForm.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ export const FilterLiveForm = (props: FilterLiveFormProps) => {
7979
resolver: finalResolver,
8080
...rest,
8181
});
82-
const { handleSubmit, getValues, reset, watch, formState } = formContext;
83-
const { isValid } = formState;
82+
const { handleSubmit, getValues, reset, watch } = formContext;
8483

8584
// Reapply filterValues when they change externally
8685
useEffect(() => {
@@ -95,11 +94,9 @@ export const FilterLiveForm = (props: FilterLiveFormProps) => {
9594
}, [JSON.stringify(filterValues), getValues, reset]);
9695

9796
const onSubmit = (values: any): void => {
98-
// Do not call setFilters if the form is invalid
99-
if (!isValid) {
100-
return;
101-
}
102-
setFilters(mergeObjNotArray(filterValues, values));
97+
handleSubmit(newValues =>
98+
setFilters(mergeObjNotArray(filterValues, newValues))
99+
)(values);
103100
};
104101
const debouncedOnSubmit = useDebouncedEvent(onSubmit, debounce || 0);
105102

0 commit comments

Comments
 (0)