react-jsonschema-form icon indicating copy to clipboard operation
react-jsonschema-form copied to clipboard

Bug: issue with dependencies computeDefaults (#4271)

Open abdalla-rko opened this issue 6 months ago • 0 comments

Reasons for making this change

fixes #4271

Fix is to first get the defaults from the properties if set, to ensure the dependencies conditions are resolved based on it. Then we can get the dependencies defaults.

The issue was caused by the **load** method in the playground and not by the formData editor as I explained in #4271. The **load** method updates the formData state because it is initially set to samples.Simple.formData after the component has mounted. This triggers the form componentDidUpdate which will try to get computedDefaults again.

Checklist

  • [x] I'm adding or updating code
    • [x] I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • [ ] I've updated docs if needed
    • [x] I've updated the changelog with a description of the PR

abdalla-rko avatar Aug 23 '24 00:08 abdalla-rko