react-admin
react-admin copied to clipboard
Custom List Actions Crashes When There are no filters
What you were expecting:
Being able to set a custom list actions
component even when there are no filters
What happened instead: The page crashes with the following error:
FilterButton requires filters prop to be set
Steps to reproduce: Follow the documentation for custom actions: https://marmelab.com/react-admin/List.html#actions
Related code: https://codesandbox.io/s/restless-mountain-frq98x?file=/src/posts/PostList.tsx
I update the PostList
so that it has a very simple custom actions component and no filters.
- React-admin version: 4.1.2
- Last version that did not exhibit the issue (if applicable):
- React version:
- Browser:
- Stack trace (in case of a JS error):
For my understanding I would like you to explain why you consider this behavior as a bug?
If neither the FilterButton component nor the List component have filter props, why shouldn't we display an error?
So this might just be a documentation issue but I still think we should ensure adding the <FilterButton>
in your custom actions shouldn't crash if you haven't provided any filter yet.