Skip to content

Fix ArrayInput makes the form dirty in strict mode#10421

Merged
slax57 merged 2 commits intomasterfrom
fix-array-input-dirty
Dec 19, 2024
Merged

Fix ArrayInput makes the form dirty in strict mode#10421
slax57 merged 2 commits intomasterfrom
fix-array-input-dirty

Conversation

@djhi
Copy link
Contributor

@djhi djhi commented Dec 18, 2024

Problem

Fixes #9661

Solution

We had a workaround for adding validation on the ArrayInput itself (like min/max number of items) that triggered a register/unregister of the input in react-hook-form inside a useEffect. This effect is run twice in StrictMode.
It appears the workaround isn't needed anymore to have validation on the ArrayInput.

How To Test

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@djhi djhi added the RFR Ready For Review label Dec 18, 2024
@slax57 slax57 self-requested a review December 19, 2024 10:12
@slax57 slax57 merged commit cd440fd into master Dec 19, 2024
@slax57 slax57 deleted the fix-array-input-dirty branch December 19, 2024 13:53
@slax57 slax57 added this to the 5.4.4 milestone Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Development

Successfully merging this pull request may close these issues.

SimpleForm isDirty is always true if ArrayInput is used

2 participants