Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] SimpleForm/TabbedForm - deprecate defaultValue #3636

Closed
wants to merge 1 commit into from
Closed

[RFR] SimpleForm/TabbedForm - deprecate defaultValue #3636

wants to merge 1 commit into from

Conversation

natrim
Copy link
Contributor

@natrim natrim commented Sep 2, 2019

and add initialValues to proptypes
fixes #3627


### Per Input Default Value

Alternatively, you can specify a `defaultValue` prop directly in `<Input>` components. Just like for form-level default values, an input-level default value can be a scalar, or a function returning a scalar. React-admin will merge the input default values with the form default value (input > form):
Alternatively, you can specify a `defaultValue` prop directly in `<Input>` components. Default value can be a scalar, or a function returning a scalar. React-admin will merge the input default values with the form default value (input > form):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that both defaultValue and initialValue are supported: https://final-form.org/docs/react-final-form/types/FieldProps#defaultvalue & https://final-form.org/docs/react-final-form/types/FieldProps#initialvalue.

Probably worth to mention that users should read final-form documentation

Copy link
Contributor Author

@natrim natrim Sep 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialValue on input does not work either in SImpleForm or Tabbed Form

it would probably need extra some changes for it to be passed to final-form

@natrim natrim changed the title SimpleForm/TabbedForm - deprecate defaultValue [RFR] SimpleForm/TabbedForm - deprecate defaultValue Sep 2, 2019
Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about what to do about the defaultValue function support. Should we add it back as initialValues too ?

Otherwise, we would have to add an example about how to migrate from it by wrapping SimpleForm and TabbedForm to see the record and build the initial values from it

packages/ra-ui-materialui/src/form/SimpleForm.js Outdated Show resolved Hide resolved
packages/ra-ui-materialui/src/form/SimpleForm.js Outdated Show resolved Hide resolved
UPGRADE.md Outdated Show resolved Hide resolved
@natrim
Copy link
Contributor Author

natrim commented Sep 2, 2019

fixed and repushed

and add initialValues to proptypes
@djhi
Copy link
Collaborator

djhi commented Oct 1, 2019

I had to rebase it and wasn't able to do it on your fork. Closed in favor of #3756.

@djhi djhi closed this Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants