Skip to content

Commit

Permalink
Merge pull request #9980 from marmelab/fix-filter-vs-filters-warning
Browse files Browse the repository at this point in the history
Fix `filter` vs `filters` warning
  • Loading branch information
adguernier authored Jul 8, 2024
2 parents 45151e0 + a58cdaf commit 0b3636d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/ra-core/src/controller/list/useListController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ export const useListController = <RecordType extends RaRecord = any>(
`useListController requires a non-empty resource prop or context`
);
}
if (filter && isValidElement(filter)) {
if (
filter &&
(isValidElement(filter) ||
(Array.isArray(filter) && filter.some(isValidElement)))
) {
throw new Error(
'useListController received a React element as `filter` props. If you intended to set the list filter elements, use the `filters` (with an s) prop instead. The `filter` prop is internal and should not be set by the developer.'
);
Expand Down

0 comments on commit 0b3636d

Please sign in to comment.