You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix 391 & 2099 with new initialFormData prop and setFieldValue() on Form (#4815)
* Fix 391 with new initialFormData prop on Form
Fixes#391 by adding support for the `initialFormData` prop on `Form`
- Updated `@rjsf/core` as follows:
- Updated `FormProps` to add the new `initialFormData` prop
- Updated `Form` so that is behaves as a "controlled" form when `formData` is passed and uncontrolled when `initialFormData` is passed
- Also fixed an issue where live validation was called on the initial form render, causing errors to show immediately, partially fixing #512
- Updated the tests for `Form`, `ArrayField`, `ObjectField` and `StringField` to deal with the change to not live validating on initial render
- Added new tests for `Form` that verify the fixes around controlled vs uncontrolled form related to the `initialFormData` and how it affects `reset()`
- Updated `form-props.md` and `v6x upgrade guide.md` to document the new `initialFormData` prop and the other potentially breaking `Form` fix
- Updated the `CHANGELOG.md` accordingly
* Apply suggestions from code review
* - Improved documentation
* - Fixed blank lines
* Update packages/docs/docs/migration-guides/v6.x upgrade guide.md
* - Updated `CHANGELOG.md` for other merged PR
* - Added `setFieldValue()` implementation on `Form`
* - Made `setFieldValue()` pass in the id of the field to `onChange()`
* Update packages/core/test/ArrayField.test.jsx
Co-authored-by: Nick Grosenbacher <[email protected]>
---------
Co-authored-by: Nick Grosenbacher <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,10 +21,19 @@ should change the heading of the (upcoming) version to include a major version b
21
21
22
22
- Updated `FormProps` to add new `onChange`/`onBlur` values for the `liveValidate` and `liveOmit` props, deprecating the `boolean` aspect of them
23
23
- Updated `Form` to support the new feature to do `onBlur` handling of `liveValidate` and `liveOmit`
24
+
- Updated `FormProps` to add the new `initialFormData` prop
25
+
- Updated `Form` so that is behaves as a "controlled" form when `formData` is passed and uncontrolled when `initialFormData` is passed, fixing [#391](https://github.com/rjsf-team/react-jsonschema-form/issues/391)
26
+
- Also fixed an issue where live validation was called on the initial form render, causing errors to show immediately, partially fixing [#512](https://github.com/rjsf-team/react-jsonschema-form/issues/512)
27
+
- Updated `Form` to add a new programmatic function, `setFieldValue(fieldPath: string | FieldPathList, newValue?: T): void`, fixing [#2099](https://github.com/rjsf-team/react-jsonschema-form/issues/2099)
28
+
29
+
## @rjsf/mantine
30
+
31
+
- Updated `FieldHelpTemplate` to avoid issue when `help``and `fieldPathId` are undefined
24
32
25
33
## Dev / docs / playground
34
+
26
35
- Updated the playground to switch `liveValidate` and `liveOmit` from checkboxes to radio buttons for the new options
27
-
- Updated `form-props.md` and `v6x upgrade guide.md` to document the new feature and deprecation
36
+
- Updated `internals.md`, `form-props.md` and `v6x upgrade guide.md` to document the new features, potential breaking changes and deprecations
28
37
29
38
# 6.0.0-beta.22
30
39
@@ -127,6 +136,7 @@ should change the heading of the (upcoming) version to include a major version b
127
136
- BREAKING CHANGE: Renamed `ArrayFieldItemButtonsTemplateType` to `ArrayFieldItemButtonsTemplateProps` and updated it to replace the `onAddIndexClick()`, `onCopyIndexClick()`, `onDropIndexClick()` and `onReorderClick()` callback-generator props with the `onAddItem()`, `onCopyItem()`, `onMoveUpItem()`, `onMoveDownItem()` and `onRemoveItem()` callback props
128
137
129
138
## Dev / docs / playground
139
+
130
140
- Updated the `formTests.tsx` snapshots to add an `anyOf` of all arrays with different item types and removed the disabling of the optional data controls feature for the optional object with oneOfs
131
141
- Updated the snapshots in all of the themes accordingly
132
142
- Updated the playground to make the same changes as `formTests.tsx` in the `optionalDataControls.ts` sample, moving the `experimental_defaultFormStateBehavior` inside of a `liveSettings` block
0 commit comments