-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix: made small changes to utility functions to fix #3997, #4314 and #4322 #4329
Fix: made small changes to utility functions to fix #3997, #4314 and #4322 #4329
Conversation
please merge this pr fast |
I am having to deal with a regression that was detected in testing and my job is quite busy. Working as fast as I can, sorry |
5db135a
to
d06c44c
Compare
Ok, in order to avoid regressions, I added a new, optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming CI passes once docs build is fixed!
it('should return default when formData is undefined and defaultSupercedesUndefined true', () => { | ||
expect(mergeDefaultsWithFormData({}, undefined, undefined, true)).toEqual({}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to add a case where null
is returned when formData
is null
cf72e03
to
0294e30
Compare
…rjsf-team#4322 Fixes rjsf-team#3997 and rjsf-team#4322 - In `@rjsf/utils`, made the following changes: - Updated `mergeDefaultsWithFormData()` to not overwrite a default when the formData has an undefined value - Updated `getClosestMatchingOption()` to improve the scoring function so that an object container that matches a key gets an extra point - In `@rjsf/core`, updated `MultiSchemaField` to call `onChange` after setting the new option in state rather than before - Updated the `CHANGELOG.md` accordingly
…ta` prop to the `Experimental_DefaultFormStateBehavior` - Updated `mergeDefaultsWithFormData()` to add new optional `defaultSupercedesUndefined` that when true uses the defaults rather than `undefined` formData - Updated `getDefaultFormState()` to pass true to `mergeDefaultsWithFormData` for `defaultSupercedesUndefined` when `mergeDefaultsIntoFormData` has the value `useDefaultIfFormDataUndefined` - Updated the documentation for the new capabilities - Updated the playground to add controls for the new `mergeDefaultsIntoFormData` option - moved the `Show Error List` component over one column, making it inline radio buttons rather than a select
0294e30
to
2c9d418
Compare
Reasons for making this change
Fixes #3977, #4314, #4322
@rjsf/utils
, made the following changes:mergeDefaultsIntoFormData
option toExperimental_DefaultFormStateBehavior
type to control how to handle merging of defaultsmergeDefaultsWithFormData()
to add new optionaldefaultSupercedesUndefined
that when true uses the defaults rather thanundefined
formDatagetDefaultFormState()
to pass true tomergeDefaultsWithFormData
fordefaultSupercedesUndefined
whenmergeDefaultsIntoFormData
has the valueuseDefaultIfFormDataUndefined
getClosestMatchingOption()
to improve the scoring function so that an object container that matches a key gets an extra point@rjsf/core
, updatedMultiSchemaField
to callonChange
after setting the new option in state rather than beforemergeDefaultsIntoFormData
optionShow Error List
component over one column, making it inline radio buttons rather than a selectCHANGELOG.md
accordinglyChecklist
npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update
to update snapshots, if needed.