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

isDirty from form groups is broken with array inputs #8400

Closed
ghost91- opened this issue Nov 16, 2022 · 1 comment · Fixed by #8433
Closed

isDirty from form groups is broken with array inputs #8400

ghost91- opened this issue Nov 16, 2022 · 1 comment · Fixed by #8433
Labels

Comments

@ghost91-
Copy link

What you were expecting:
When using the FormGroupContextProvider around an ArrayInput, the isDirty property of useFormGroup still is a boolean, as the type definitions indicate.

What happened instead:
When using the FormGroupContextProvider around an ArrayInput, the isDirty property of useFormGroup is broken: When changing the array input, the isDirty property is set to some array that containes information about properties of array elements that have changed. But it should be just a boolean.

Steps to reproduce:

  1. Use an ArrayInput inside a FormGroupContextProvider
  2. Inside that FormGroupContextProvider, also use a component that uses isDirty via useFormGroup in some way (e.g., by displaying it)
  3. Adjust values managed by the ArrayInput, or add/delete items of the ArrayInput
  4. Observe that the isDirty property is set to an array, instead of just a boolean.

Related code:
https://codesandbox.io/s/goofy-tess-wzpom6?file=/src/posts/PostEdit.tsx:5416-5440

In the PostsEdit.tsx in the miscellaneous tab, I added a FormGroupContextProvider around the backlinks ArrayInput, which shows the problem.

Other information:
output

@WiXSL WiXSL added the bug label Nov 16, 2022
@WiXSL
Copy link
Contributor

WiXSL commented Nov 16, 2022

Reproduced!
Thanks for the report.

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

Successfully merging a pull request may close this issue.

2 participants