diff --git a/docs/Upgrade.md b/docs/Upgrade.md index 0c74b23988b..f47b872c6d2 100644 --- a/docs/Upgrade.md +++ b/docs/Upgrade.md @@ -437,6 +437,28 @@ const PostEdit = () => ( ); ``` +## Fields Components Requires The `source` Prop + +The `FieldProps` interface now requires the `source` prop to be defined. As a consequence, all the default fields components also require the `source` prop to be defined. +This impacts custom fields that typed their props with the `FieldProps` interface. If your custom field is not meant to be used in a ``, you may declare the `source` prop optional: + +```diff +import { FieldProps, useRecordContext } from 'react-admin'; + +-const AvatarField = (props: FieldProps) => { ++const AvatarField = (props: Omit) => { + const record = useRecordContext(); + if (!record) return null; + return ( + + ); +} +``` + ## Upgrading to v4 If you are on react-admin v3, follow the [Upgrading to v4](https://marmelab.com/react-admin/doc/4.16/Upgrade.html) guide before upgrading to v5.