rjsf-team/react-jsonschema-form

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

Open

#4483 aperta il 5 feb 2025

Vedi su GitHub
 (2 commenti) (1 reazione) (0 assegnatari)TypeScript (2136 fork)batch import
bughelp wanted

Metriche repository

Star
 (13.175 star)
Metriche merge PR
 (Merge medio 3g 17h) (32 PR mergiate in 30 g)

Descrizione

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.

Guida contributor