From e526918bf9b02bfdf1f5aed577934ff001126971 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Fri, 25 Aug 2023 17:04:14 +0200 Subject: [PATCH] [Doc] Fix `` example throws an error Closes #7801 --- docs/List.md | 7 ++++++- packages/ra-ui-materialui/src/list/filter/FilterButton.tsx | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/List.md b/docs/List.md index 67ed5c41283..49baf284ea5 100644 --- a/docs/List.md +++ b/docs/List.md @@ -110,8 +110,13 @@ const ListActions = () => ( ); +const postFilters = [ + , + , +]; + export const PostList = () => ( - }> + } filters={postFilters}> ... diff --git a/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx b/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx index adf059f46d5..91084c841ac 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx @@ -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 component requires the prop to be set' + ); } const hiddenFilters = filters.filter(