Migrate to 0.15
0.15 reads definition format 1.2, which adds props on fields. Five runtime changes can change submitted values.
bash
npm i @formhaus/core@^0.15 @formhaus/react@^0.15
npm i @formhaus/core@^0.15 @formhaus/vue@^0.15Changes
| Area | Old (0.14) | New (0.15) | Action |
|---|---|---|---|
| Values | A field that started hidden, or was hidden and shown again, came back empty, except a hidden field | A field shown again gets back its last value. A field without one, such as a field that starts hidden, gets its initial value or defaultValue | Remove workarounds that restore values or set defaults after a field appears |
| Groups | A group shown again started with defaultItems new items | It gets back its last items, or else its initial items | None |
| Groups | An item in the initial values or in reset(values) kept item fields it left out empty | It gets their defaultValue, like top-level fields | Drop item defaults that the app fills itself |
| Server | validateSubmission() filled the defaultValue of a key missing from the payload | A missing key stays missing | Make sure the client sends every field it wants saved |
| Values | A cleared number input wrote '' | It writes null | Treat null as a cleared number on the server |
| Format | FORMAT_VERSION was "1.1" | "1.2" | Set "formatVersion": "1.2" on definitions with props |
| Types | Every node in FormNode and FormSection.fields had a label | A hidden field is a HiddenFormField whose label is optional | Code that passes these nodes where a FormField is expected may need a type check for type === 'hidden' |