react-jsonschema-form
react-jsonschema-form copied to clipboard
Fix 3759 - uneditable & permanent defaults with additional properties
Reasons for making this change
Fixes #3759
Additional properties with defaults set currently creates a permanent key-value pair that is essentially uneditable. Trying to edit the key creates an entirely new key value entry on blur while still keeping the default key-value pair. The default key-value pair is also not deletable. Solution here generates defaults for additional properties once on form initialization, and then skips regeneration on any form update
This solution works for root & nested additionalProperties (see tests) Allows for 'reset' form to regenerate additionalProperties defaults Also fixes the issue I mentioned in the Closed PR with custom formData not being applied when generating additionalProperties defaults
Checklist
- [x] I'm updating documentation
- [x] I've checked the rendering of the Markdown text I've added
- [x] I'm adding or updating code
- [ ] I'm adding a new feature
- [ ] I've updated the playground with an example use of the feature