Commit b01e29d
fix(plugin-form): a wizard that ends on a field-less review step can finish
A wizard step with no inputs — `{ label: 'Review', fields: [] }`, the shape
this component's own usage example ends on — rendered a bare hint div and NO
`<form>`. The footer Next/Create buttons submit the step form natively
(`type="submit" form={stepFormId}`), so on that step they pointed at a target
that did not exist: clicking Create did nothing at all and the wizard could
never be completed. Observed directly — `create` call count 0, no error, no
feedback.
This is fallout from the fix the regression suite guards: moving the buttons
off `onClick={() => handleStepSubmit(formData)}` onto native submission is what
made a missing form fatal. Render a real form on the field-less step; it
contributes no values of its own, so the record is whatever the earlier steps
accumulated.
Also correct that suite's docblock, which overstated what it covers. Two
redundant mechanisms carry values across steps (react-hook-form retains
unmounted fields; the wizard merges `{...formData, ...stepData}`), and
"submits the merged payload" passes when EITHER is broken alone — it catches a
total failure to accumulate, not a broken merge. The new field-less-step case
is what pins the merge down: with no react-hook-form instance on that step,
`formData` is the only carrier left. Verified by mutation — breaking only the
merge now fails with `expected {} to deeply equal {"name": "Alice"}`, and
reverting the form fix fails with `expected null not to be null`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 2374a49 commit b01e29d
2 files changed
Lines changed: 65 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
14 | 26 | | |
15 | 27 | | |
16 | 28 | | |
| |||
90 | 102 | | |
91 | 103 | | |
92 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
93 | 138 | | |
94 | 139 | | |
95 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
541 | | - | |
542 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
543 | 560 | | |
544 | 561 | | |
545 | 562 | | |
| |||
0 commit comments