Commit 144f764
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 <nickgrosenbacher@gmail.com>
---------
Co-authored-by: Nick Grosenbacher <nickgrosenbacher@gmail.com>1 parent a86aab9 commit 144f764
File tree
10 files changed
+528
-31
lines changed- packages
- core
- src/components
- test
- docs/docs
- advanced-customization
- api-reference
- migration-guides
10 files changed
+528
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 | | |
25 | 33 | | |
| 34 | + | |
26 | 35 | | |
27 | | - | |
| 36 | + | |
28 | 37 | | |
29 | 38 | | |
30 | 39 | | |
| |||
127 | 136 | | |
128 | 137 | | |
129 | 138 | | |
| 139 | + | |
130 | 140 | | |
131 | 141 | | |
132 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
| |||
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
364 | | - | |
365 | | - | |
366 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
367 | 378 | | |
368 | 379 | | |
369 | 380 | | |
| |||
440 | 451 | | |
441 | 452 | | |
442 | 453 | | |
443 | | - | |
444 | 454 | | |
445 | 455 | | |
446 | 456 | | |
| |||
476 | 486 | | |
477 | 487 | | |
478 | 488 | | |
| 489 | + | |
479 | 490 | | |
480 | 491 | | |
481 | 492 | | |
| |||
506 | 517 | | |
507 | 518 | | |
508 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
509 | 528 | | |
510 | 529 | | |
511 | | - | |
| 530 | + | |
512 | 531 | | |
513 | 532 | | |
514 | 533 | | |
| |||
799 | 818 | | |
800 | 819 | | |
801 | 820 | | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
802 | 835 | | |
803 | 836 | | |
804 | 837 | | |
| |||
941 | 974 | | |
942 | 975 | | |
943 | 976 | | |
944 | | - | |
945 | | - | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
946 | 987 | | |
947 | 988 | | |
948 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
383 | 386 | | |
384 | 387 | | |
385 | 388 | | |
| |||
1302 | 1305 | | |
1303 | 1306 | | |
1304 | 1307 | | |
| 1308 | + | |
| 1309 | + | |
1305 | 1310 | | |
1306 | 1311 | | |
1307 | 1312 | | |
| |||
1452 | 1457 | | |
1453 | 1458 | | |
1454 | 1459 | | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
1455 | 1463 | | |
1456 | 1464 | | |
1457 | 1465 | | |
| |||
1660 | 1668 | | |
1661 | 1669 | | |
1662 | 1670 | | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
1663 | 1674 | | |
1664 | 1675 | | |
1665 | 1676 | | |
| |||
1733 | 1744 | | |
1734 | 1745 | | |
1735 | 1746 | | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
1736 | 1750 | | |
1737 | 1751 | | |
1738 | 1752 | | |
| |||
3136 | 3150 | | |
3137 | 3151 | | |
3138 | 3152 | | |
3139 | | - | |
3140 | | - | |
3141 | | - | |
3142 | | - | |
3143 | | - | |
| 3153 | + | |
3144 | 3154 | | |
3145 | 3155 | | |
3146 | 3156 | | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
3147 | 3160 | | |
3148 | 3161 | | |
3149 | 3162 | | |
3150 | | - | |
| 3163 | + | |
3151 | 3164 | | |
3152 | 3165 | | |
3153 | 3166 | | |
| |||
0 commit comments