Skip to content
Source
Sign inSign up
TanStack/form

docs: update migration guide with renamed form methods and new metada… #2421

Mergedkazbekaskarov(GitHub profile, opens in a new tab)merged 1 commit intoalpha fromrefs/pull/2421/headmerged by LeCarbonator(GitHub profile, opens in a new tab)

Showing 1 changed file with 122 additions and 0 deletions.

x
0 of 1 viewed, 1 left
122 additions and 0 deletionsdocs/migrate-from-v1.mdModified
View file
@@ -31,6 +31,9 @@
- Keep array mutations on the `ArrayField` render prop, such as
`array.pushValue(...)`, or use path-based form methods such as
`form.pushFieldValue(...)` when the control lives outside the render prop.
+- Rename `form.moveFieldValues` to `form.moveFieldValue`, and replace removed
+ form methods such as `setFieldMeta` and `validateField` as described in
+ [Removed and renamed form methods](#removed-and-renamed-form-methods).
- Read errors from `field.errors`, `group.state.errors`, and
`form.state.errors` as validation issue objects. Use `error.message` when
rendering text.
@@ -583,6 +586,125 @@
​
For current usage and adapter-specific examples, see [Arrays](./arrays).
​
+## Removed and renamed form methods
+​
+The v2 form API is smaller than v1's. It reads and updates values, mutates
+arrays, runs form-level validation, submits, and resets. Field metadata now
+lives on the field API, validators and submit results produce errors instead
+of code writing them directly, and nothing replaces the internal
+field-registry helpers.
+​
+| v1 | v2 |
+| ------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
+| `moveFieldValues(name, from, to)` | `moveFieldValue(name, from, to)` |
+| `setFieldMeta(name, updater)` | `setFieldValue` update options, `handleSubmit()`, or `errorVisibility` |
+| `getFieldMeta(name)` | `field.meta` |
+| `resetFieldMeta(...)` | `resetField(name)`, `field.reset()`, or `reset(form.state.values, { updateDefaultValues: false })` |
+| `validateField(name, cause)` | validator `triggers` and `watchFields` |