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

Bug: issue with dependencies computeDefaults (#4271) #4282

Merged

Conversation

abdalla-rko
Copy link
Contributor

@abdalla-rko abdalla-rko commented Aug 23, 2024

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

  • I'm adding or updating code
    • 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
    • I've updated the changelog with a description of the PR

Copy link
Member

@alfonsoar alfonsoar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to work on this bug!

Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few little organizational changes and you are good.

CHANGELOG.md Outdated Show resolved Hide resolved
packages/utils/src/schema/getDefaultFormState.ts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@heath-freenome heath-freenome merged commit fc1c8c3 into rjsf-team:main Sep 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to get rawErrors for parent schema or errorSchema in custom BaseInputTemplate
3 participants