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

Values of InputFields are not displayed in edit form if shouldUnregister is set #10194

Open
AlexDroll opened this issue Sep 10, 2024 · 3 comments
Labels

Comments

@AlexDroll
Copy link

What you were expecting:
In an EditForm with an ArrayInput all input fields show the given record values. This also holds for conditionally rendered field values if the condition is fullfilled and the shouldUnregister property is set to true.

What happened instead:
Having the following complex EditForm.
There is an ArrayInput.
One field of the array elements is only conditionally rendered depending on the value of another. Then the value of the conditionally rendered input field is not displayed (even though the field itself is rendered). This only happens if the shouldUnregister property is set to true for the conditionally rendered input field.

We just upgraded from [email protected] (where everything worked) to [email protected] where the bug occurs. In both cases we use [email protected]

Steps to reproduce:
Open this code sandbox.
Go to the comments records and open one of the comments. The value in the field "Bar" is not shown even though we would expect to see "world" there. If the "shouldUnregister" property is removed in the CommentEdit.tsx (line 166) the value is displayed correctly. However, then we would lose the unregister functionality of the field.

Hint: Starting from the provided example code sandbox for v5 we only changed the data.tsx and CommendEdit.tsx to provide the example.

Environment

  • React-admin version: 5.1.3
  • Last version that did not exhibit the issue (if applicable): 4.16.20
  • React version: 18.3.1
  • Browser: Chrome, Firefox
@djhi
Copy link
Contributor

djhi commented Sep 10, 2024

Thanks for the great report! Confirmed

@djhi djhi added the bug label Sep 10, 2024
@AlexDroll
Copy link
Author

Do you have an update on the issue? Or do you have a timeline when working on it?
Thanks!

@djhi
Copy link
Contributor

djhi commented Sep 16, 2024

No but feel free to lend a hand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants