Skip to content

Commit

Permalink
Merge pull request #9220 from marmelab/doc-list-actions-error
Browse files Browse the repository at this point in the history
[Doc] Fix `<List actions>` example throws an error
  • Loading branch information
slax57 authored Aug 25, 2023
2 parents 33bfca4 + e526918 commit 2a57294
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion docs/List.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ const ListActions = () => (
</TopToolbar>
);

const postFilters = [
<TextInput label="Search" source="q" alwaysOn />,
<TextInput label="Title" source="title" defaultValue="Hello, World!" />,
];

export const PostList = () => (
<List actions={<ListActions/>}>
<List actions={<ListActions/>} filters={postFilters}>
<DatagridConfigurable>
...
</DatagridConfigurable>
Expand Down
4 changes: 3 additions & 1 deletion packages/ra-ui-materialui/src/list/filter/FilterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export const FilterButton = (props: FilterButtonProps): JSX.Element => {
const anchorEl = useRef();

if (filters === undefined) {
throw new Error('FilterButton requires filters prop to be set');
throw new Error(
'The <FilterButton> component requires the <List filters> prop to be set'
);
}

const hiddenFilters = filters.filter(
Expand Down

0 comments on commit 2a57294

Please sign in to comment.