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

Does not remove empty objects on clearing input field value ending up with unexpected required value error #4483

Open
4 tasks done
emmaindal opened this issue Feb 5, 2025 · 0 comments

Comments

@emmaindal
Copy link

Prerequisites

What theme are you using?

material-ui

Version

5.21.1

Current Behavior

When a required field is not modified yet, it submits fine. When a required field is modified, it validates correctly prompting me to fill out the required field. If I then delete all values, it prompts me to fill out the required field even if all values has been cleared.

Expected Behavior

It should submit the form without errors when all values has been removed

Steps To Reproduce

  1. In this playground enviornment
  2. Start by submitting the form without entering any values (should submit without errors)
  3. Add a value to second-test > testProp1 (should error about missing required testProp2)
  4. Add testProp2 (should submit without errors)
  5. Remove values for both testProp1 and testProp2 (should submit without errors but does not and show error about missing required testProp2)

This seems to be because of the empty object that never gets cleaned up when all values are deleted.

Environment

Anything else?

Note that Disable HTML 5 validation option must be selected.

@emmaindal emmaindal added bug needs triage Initial label given, to be assigned correct labels and assigned labels Feb 5, 2025
@heath-freenome heath-freenome added help wanted awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants