Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove list's setFilters default debounce #9682

Merged
merged 10 commits into from
Feb 27, 2024
Merged

Remove list's setFilters default debounce #9682

merged 10 commits into from
Feb 27, 2024

Conversation

fzaninotto
Copy link
Member

Problem

The setFilters callback returned by useListController is debounced by default. This creates numerous WTF issues (e.g. #4189). This default makes sense for the Filter form/button combo, but not for the other filters.

Besides, the setFilters returned by other controllers (useList, etc) isn’t debounced by default.

Solution

Make the setFilters default to debounce=false. Force the debounce in FilterForm.

Also, revert #9639 as these explanations are no longer necessary

@@ -345,7 +345,7 @@ If you provided a React element for the optionText prop, you must also provide t
return;
}

setFilters(filterToQuery(filter), undefined, true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't make sense as the call is debounced two lines earlier. The previous code caused a double debounce.

@fzaninotto fzaninotto mentioned this pull request Feb 26, 2024
24 tasks
@slax57 slax57 self-requested a review February 26, 2024 08:47
Copy link
Contributor

@slax57 slax57 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicking. Otherwise, LGTM!

docs/FilteringTutorial.md Outdated Show resolved Hide resolved
docs/useListContext.md Outdated Show resolved Hide resolved
docs/useListController.md Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/input/AutocompleteInput.tsx Outdated Show resolved Hide resolved
@adguernier adguernier self-requested a review February 26, 2024 15:13
@slax57 slax57 added this to the 5.0.0 milestone Feb 27, 2024
@slax57 slax57 merged commit 5c68681 into next Feb 27, 2024
12 checks passed
@slax57 slax57 deleted the setfilters-no-debounce branch February 27, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants