diff --git a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.stories.tsx b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.stories.tsx index 71b7041432f..4065c8e0129 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.stories.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteArrayInput.stories.tsx @@ -1,6 +1,12 @@ import * as React from 'react'; import { Admin } from 'react-admin'; -import { RaRecord, Resource, required, useCreate } from 'ra-core'; +import { + RaRecord, + Resource, + required, + useCreate, + useRecordContext, +} from 'ra-core'; import polyglotI18nProvider from 'ra-i18n-polyglot'; import englishMessages from 'ra-language-english'; import { createMemoryHistory } from 'history'; @@ -226,11 +232,14 @@ export const CustomTextFunction = () => ( ); -const CustomOption = ({ record, ...rest }: { record?: RaRecord }) => ( -
- {record?.fullName} ({record?.language}) -
-); +const CustomOption = () => { + const record = useRecordContext(); + return ( +
+ {record?.fullName} ({record?.language}) +
+ ); +}; const BookEditCustomOptions = () => { const choices = [