---
url: https://formhaus.dev/migrate/1.x.md
description: >-
  Upgrade @formhaus/core and @formhaus/react from 0.11 to 1.x in one pass: every
  breaking change from 0.14 to 0.22 in release order, with before and after
  code.
---

# Migrate from 0.11 to 1.x

This page lists every breaking change of `@formhaus/core` and `@formhaus/react` between 0.11 and 1.x, in release order, and the behavior changes of 0.20. 0.12, 0.13, 0.16, 0.17 and 0.18 have none. 1.x has no breaking changes outside the translation API of 1.7. The release guides have the details: [0.14](/migrate/0.14), [0.15](/migrate/0.15), [0.19](/migrate/0.19), [0.20](/migrate/0.20), [0.22](/migrate/0.22).

```bash
npm i @formhaus/core@^1 @formhaus/react@^1
```

Upgrade the server that runs `validateSubmission()` before the clients: an older core rejects definitions that use newer formats.

## Install

| Old (0.11) | New (1.x) | Action |
|---|---|---|
| Node 20 | Node `22.12` or later | Upgrade Node |
| `@formhaus/core` peer range `^0.11.0` | The same minor as the adapter, such as `~1.1.0` for `@formhaus/react` 1.1 | Install core and react of the same version |
| React `^18.0.0 \|\| ^19.0.0` | Unchanged | None |

## 0.14: sections, groups and new built-in types

| Old (0.13) | New (0.14) | Action |
|---|---|---|
| `FormStep.fields` and `FormDefinition.fields` were `FormField[]` | `FormNode[]`: a field, a section or a group | Narrow with `isSection()` and `isGroup()` before reading field properties |
| Every error key was a field key | Item errors use paths such as `participants.1.email` | Map error keys through the path form when you match them to fields |
| `visibleFields` listed everything to draw | `visibleNodes` holds the tree. `visibleFields` stays flat | Render sections and groups from `visibleNodes` |
| `time`, `hidden`, `section` and `group` could be custom types | Built-in types with their own checks | Rename a custom type with a dash, such as `x-time` |
| Options with a repeated `value` passed | `duplicate-option-value` error | Give every option of a field a unique `value` |

Before:

```ts
for (const field of step.fields) renderField(field);
```

After:

```ts
import { isGroup, isSection } from '@formhaus/core';

for (const node of step.fields) {
  if (isSection(node)) renderSection(node);
  else if (isGroup(node)) renderGroup(node);
  else renderField(node);
}
```

## 0.15: values of fields shown later

| Old (0.14) | New (0.15) | Action |
|---|---|---|
| A field hidden and shown again came back empty | It gets back its last value. A field that starts hidden gets its initial value or `defaultValue` | Remove code that restores values or sets defaults after a field appears |
| A group shown again started with `defaultItems` new items | It gets back its last items, or else its initial items | None |
| An item in the initial values left the item fields it omits empty | They get their `defaultValue` | Drop item defaults that the app fills itself |
| `validateSubmission()` filled the `defaultValue` of a missing key | A missing key stays missing | Send every field the client wants saved |
| A cleared `number` input wrote `''` | It writes `null` | Treat `null` as a cleared number on the server |
| Every node had a `label` | A `hidden` field is a `HiddenFormField` with an optional `label` | Check `type === 'hidden'` where a `FormField` with a label is expected |

Before:

```ts
const age = values.age === '' ? undefined : Number(values.age);
```

After:

```ts
const age = values.age === null ? undefined : values.age;
```

## 0.19: scale and rating, Node 22.12, default messages

| Old (0.18) | New (0.19) | Action |
|---|---|---|
| `rating` and `scale` could be custom types | Built-in types: a whole number in the range, with built-in renderers | Rename a custom type with a dash, such as `x-rating`, in the definition and in `components` |
| `DefaultFieldType` had 17 names | It adds `scale` and `rating` | Add both to an exhaustive `Record<DefaultFieldType, …>` |
| Node 20 | Node `22.12` | Upgrade Node |
| `Must be at least {min} characters` | `Minimum length is {min}` | Update tests that compare the texts, or set the old ones in `messages` |

The other changed texts are listed in [Migrate to 0.19](/migrate/0.19#default-messages). To keep the old ones:

```json
{ "messages": { "minLength": "Must be at least {min} characters", "maxLength": "Must be at most {max} characters" } }
```

## 0.20: step progress and error summary

0.20 has no API breaks. Two default texts and positions change, which can break snapshot tests and custom styles.

| Old (0.19) | New (0.20) | Action |
|---|---|---|
| The step progress marked a step with errors as `· 2 errors` | `· Errors: 2` | Set the `stepErrors` label, such as `"labels": { "stepErrors": "{count} errors" }`, to change the text |
| The error summary sat above the fields | It sits below the fields and form-level errors, above the step buttons | Update tests and CSS that depend on its position |

## 0.21: server values

| Old (0.20) | New (0.21) | Action |
|---|---|---|
| `validateSubmission()` returned a value that failed its type check in `values` | It leaves the value out and reports only its type error | Read `errors` before you save `values` |

## 0.22: removed APIs and new defaults

### Core

| Old (0.21) | New (0.22) | Action |
|---|---|---|
| `validateDefinition` | Removed | Use `checkDefinition(input).map((issue) => issue.message)` |
| `FormAnalyticsEvent` | Removed | Use `FormEvent` |
| `SubmitFn` | `AfterSubmitFn` | Rename the type |
| `ValidationRule` | Removed | Use `MessageKey` |
| `parseDefinition(input, options)` | `parseDefinition(input)` | Drop the second argument |
| `validateFieldValue`, `validateFields` and `validateStep` took `validators, messages` | They take `{ validators, messages }` | Pass an options object |
| `form_submit_failed` fired only after `form_submitted` | It also fires with `reason: 'validation'` | Count only `reason: 'rejected'` and `'error'` for the old numbers |
| `invalid-range`, `empty-label`, `i18n-unbound-slot` | `min-greater-than-max`, `default-items-greater-than-max`, `group-item-limit`, `invalid-columns`, `missing-label`, `i18n-key-without-text` | Rename in code that matches issue codes |
| Cloud client functions with positional arguments | One options object each | See [Cloud client](/migrate/0.22#cloud-client) |

Before:

```ts
const errors = validateFields(step.fields, values, validators, messages);
```

After:

```ts
const errors = validateFields(step.fields, values, { validators, messages });
```

### React

| Old (0.21) | New (0.22) | Action |
|---|---|---|
| `onAnalyticsEvent` | Removed | Use `onFormEvent` |
| `onPrev` in `FormActionsProps` | `onBack` | Rename in a custom actions component |
| `ItemComponent` in `GroupComponentProps` | `itemComponent` | Rename in a custom group component |
| `useLocalizedForm(definition, source, deps)` | `useLocalizedForm(definition, source, { key })` | Replace `deps` with `{ key }` |
| `errorSummary` was off by default | The error summary shows by default | Pass `errorSummary={false}` to hide it |
| Focus moved to the first invalid field | With two or more errors, focus moves to the error summary | Update tests that expect focus on the first field |
| `draftStore` was off in `FormhausForm` | A `sessionStorage` draft without `password`, `file` and `hidden` values | Pass `draftStore={false}` to turn drafts off |
| Private `--fh-*` custom properties, such as `--fh-auto-input-padding` | `--fhi-*` | Set the public variable instead, such as `--fh-input-padding` |

Before:

```tsx
<FormRenderer definition={definition} onAnalyticsEvent={track} onSubmit={save} />
```

After:

```tsx
<FormRenderer definition={definition} onFormEvent={track} errorSummary={false} onSubmit={save} />
```

Keep `errorSummary={false}` only if your page shows errors another way.

## 1.0 and later

1.0 has no API changes from 0.22. Later 1.x releases add features without breaking changes, except the translation API in 1.7. See [Stable API](/guide/stability).

| Old (1.6) | New (1.7) | Action |
|---|---|---|
| `useLocalizedForm()` from `@formhaus/react/i18n` or `@formhaus/vue/i18n` | Removed | Pass the source to the `locale` prop |
| `localize(definition, { overlay, lang })` | `localize(definition, locale)` | Pass the same list as the `locale` prop |
| `{ overlay, lang }` | `translation({ ...overlay, locale })` | Wrap the translation file |
| `TranslateSource.lang` | `TranslateSource.locale`, required | Rename it |
| `{ translate, prefix, lang }` | `translation({ translate, prefix, locale })` | Wrap it and rename `lang` to `locale` |

See [Migrate from 1.6](/guide/translations#migrate-from-1-6).
