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 formData not updating when dependencies change #4388

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

abdalla-rko
Copy link
Contributor

Reasons for making this change

Fixes #4325

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

packages/utils/src/mergeDefaultsWithFormData.ts Outdated Show resolved Hide resolved
packages/utils/src/mergeDefaultsWithFormData.ts Outdated Show resolved Hide resolved
packages/utils/src/mergeDefaultsWithFormData.ts Outdated Show resolved Hide resolved
packages/utils/src/schema/getDefaultFormState.ts Outdated Show resolved Hide resolved
packages/utils/src/schema/getDefaultFormState.ts Outdated Show resolved Hide resolved
packages/utils/src/schema/getDefaultFormState.ts Outdated Show resolved Hide resolved
packages/utils/src/schema/getDefaultFormState.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Wow, this change is really hard to parse given how much has changed.

Copy link
Contributor Author

@abdalla-rko abdalla-rko Nov 24, 2024

Choose a reason for hiding this comment

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

Yeah, I know I tried to make it little easier with comments. If it's is really hard to grasp and makes things complicated, maybe I can try to simplify it a bit more but I'm not sure if I have time this week.

* @param formData The current formData
* @returns valid formData
*/
export function getValidFormData<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't really check validity w.r.t. to the schema so I think this name might be confusing. Maybe getFormDataMatchingSchema?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @nickgros, I think it's a much better name but I've changed it to ensureFormDataMatchingSchema because I think it's slightly better.

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.

Default values not changing when dependencies updated
3 participants