-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
defaultValue in ArrayInput doesn't update #4805
Comments
That's an interesting feature, and We probably need support for this feature by the underlying library, In the meantime, you can switch |
I think this issue is the same as #4709 I have tested react-final-form-arrays and it supports default values for child inputs; however default values are removed by useInitializeFormWithRecord function, which is called from FormView function at https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/form/FormWithRedirect.tsx |
It's a complementary issue to #4709: even if default values worked inside ArrayInput, there would be no way to have a different default value for each item in the set. |
@fzaninotto, to make sure that default / initial values of array's child elements are supported, we need to somehow exclude array element from function call:
However, we cannot just exclude array elements from the call since such call are needed in many uses cases. As far as I can see, we have 2 options:
|
@fzaninotto do you have an example how an alternative / own component could look like to have updated default values for each item? |
With the release of react-admin v5, react-admin v3 has reached its end of life. We won't fix bugs or make any new release on the 3.x branch. We recommend that you switch to a more recent version of react-admin. So I'm closing this issue as we won't fix it. |
What you were expecting:
On ArrayInput for each TextInput of type id, I expect with the following:
to get a different defaultValue for each element.
What happened instead:
All the elements have the same defaultValue
Steps to reproduce:
https://codesandbox.io/s/intelligent-moser-bwvn7
Create a new post -> add Backlinks
The text was updated successfully, but these errors were encountered: