diff --git a/examples/simple/src/posts/PostCreate.js b/examples/simple/src/posts/PostCreate.js
index 72c8b86f138..1f42119095f 100644
--- a/examples/simple/src/posts/PostCreate.js
+++ b/examples/simple/src/posts/PostCreate.js
@@ -20,7 +20,7 @@ import {
useRedirect,
useNotify,
} from 'react-admin'; // eslint-disable-line import/no-unresolved
-import { useFormState } from 'react-final-form';
+import { useFormState, FormSpy } from 'react-final-form';
const SaveWithNoteButton = props => {
const [create] = useCreate('posts');
@@ -128,17 +128,17 @@ const PostCreate = ({ permissions, ...props }) => {
-
- {({ formData, ...rest }) =>
- formData.title && (
+
+ {({ values }) =>
+ values.title ? (
- )
+ ) : null
}
-
+
+
{
mutators={{ ...arrayMutators }}
keepDirtyOnReinitialize
destroyOnUnregister
+ subscription={defaultSubscription}
{...props}
render={({ submitting, ...formProps }) => (
{
);
};
+const defaultSubscription = {
+ submitting: true,
+ pristine: true,
+ valid: true,
+ invalid: true,
+};
+
export default SimpleForm;
const SimpleFormView = ({
diff --git a/packages/ra-ui-materialui/src/form/TabbedForm.js b/packages/ra-ui-materialui/src/form/TabbedForm.js
index 1ad05d5ab15..a52ff00af25 100644
--- a/packages/ra-ui-materialui/src/form/TabbedForm.js
+++ b/packages/ra-ui-materialui/src/form/TabbedForm.js
@@ -50,6 +50,7 @@ const TabbedForm = ({ initialValues, ...props }) => {
setRedirect={setRedirect}
keepDirtyOnReinitialize
destroyOnUnregister
+ subscription={defaultSubscription}
{...props}
render={({ submitting, ...formProps }) => (
{
);
};
+const defaultSubscription = {
+ submitting: true,
+ pristine: true,
+ valid: true,
+ invalid: true,
+};
+
export default withRouter(TabbedForm);
export const TabbedFormView = ({