Skip to content

Commit 56d3465

Browse files
committed
fix
1 parent 95ce17f commit 56d3465

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,16 @@ export const FilterLiveForm = (props: FilterLiveFormProps) => {
7676

7777
const formContext = useForm({
7878
mode: 'onChange',
79-
defaultValues: filterValues,
8079
resolver: finalResolver,
8180
...rest,
8281
});
8382
const { handleSubmit, getValues, reset, watch, formState } = formContext;
8483
const { isValid } = formState;
8584

86-
// Ref tracking if there are internal changes pending, i.e. changes that
87-
// should not trigger a reset
88-
const formChangesPending = React.useRef(false);
89-
9085
// Reapply filterValues when they change externally
9186
useEffect(() => {
9287
const newValues = getFilterFormValues(getValues(), filterValues);
9388
const previousValues = getValues();
94-
if (formChangesPending.current) {
95-
// The effect was triggered by a form change (i.e. internal change),
96-
// so we don't need to reset the form
97-
formChangesPending.current = false;
98-
return;
99-
}
10089
if (!isEqual(newValues, previousValues)) {
10190
reset(newValues);
10291
}
@@ -110,7 +99,6 @@ export const FilterLiveForm = (props: FilterLiveFormProps) => {
11099
if (!isValid) {
111100
return;
112101
}
113-
formChangesPending.current = true;
114102
setFilters(mergeObjNotArray(filterValues, values));
115103
};
116104
const debouncedOnSubmit = useDebouncedEvent(onSubmit, debounce || 0);

0 commit comments

Comments
 (0)