Skip to content

Commit

Permalink
Fix filter vs filters warning
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Jul 8, 2024
1 parent 45151e0 commit a58cdaf
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 a58cdaf

Please sign in to comment.