Skip to content
Open Cloud

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, 0.15, 0.19, 0.20, 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 20Node 22.12 or laterUpgrade Node
@formhaus/core peer range ^0.11.0The same minor as the adapter, such as ~1.1.0 for @formhaus/react 1.1Install core and react of the same version
React ^18.0.0 || ^19.0.0UnchangedNone

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 groupNarrow with isSection() and isGroup() before reading field properties
Every error key was a field keyItem errors use paths such as participants.1.emailMap error keys through the path form when you match them to fields
visibleFields listed everything to drawvisibleNodes holds the tree. visibleFields stays flatRender sections and groups from visibleNodes
time, hidden, section and group could be custom typesBuilt-in types with their own checksRename a custom type with a dash, such as x-time
Options with a repeated value passedduplicate-option-value errorGive 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 emptyIt gets back its last value. A field that starts hidden gets its initial value or defaultValueRemove code that restores values or sets defaults after a field appears
A group shown again started with defaultItems new itemsIt gets back its last items, or else its initial itemsNone
An item in the initial values left the item fields it omits emptyThey get their defaultValueDrop item defaults that the app fills itself
validateSubmission() filled the defaultValue of a missing keyA missing key stays missingSend every field the client wants saved
A cleared number input wrote ''It writes nullTreat null as a cleared number on the server
Every node had a labelA hidden field is a HiddenFormField with an optional labelCheck 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 typesBuilt-in types: a whole number in the range, with built-in renderersRename a custom type with a dash, such as x-rating, in the definition and in components
DefaultFieldType had 17 namesIt adds scale and ratingAdd both to an exhaustive Record<DefaultFieldType, …>
Node 20Node 22.12Upgrade Node
Must be at least {min} charactersMinimum 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. 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: 2Set the stepErrors label, such as "labels": { "stepErrors": "{count} errors" }, to change the text
The error summary sat above the fieldsIt sits below the fields and form-level errors, above the step buttonsUpdate 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 valuesIt leaves the value out and reports only its type errorRead errors before you save values

0.22: removed APIs and new defaults ​

Core ​

Old (0.21)New (0.22)Action
validateDefinitionRemovedUse checkDefinition(input).map((issue) => issue.message)
FormAnalyticsEventRemovedUse FormEvent
SubmitFnAfterSubmitFnRename the type
ValidationRuleRemovedUse MessageKey
parseDefinition(input, options)parseDefinition(input)Drop the second argument
validateFieldValue, validateFields and validateStep took validators, messagesThey take { validators, messages }Pass an options object
form_submit_failed fired only after form_submittedIt also fires with reason: 'validation'Count only reason: 'rejected' and 'error' for the old numbers
invalid-range, empty-label, i18n-unbound-slotmin-greater-than-max, default-items-greater-than-max, group-item-limit, invalid-columns, missing-label, i18n-key-without-textRename in code that matches issue codes
Cloud client functions with positional argumentsOne options object eachSee 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
onAnalyticsEventRemovedUse onFormEvent
onPrev in FormActionsPropsonBackRename in a custom actions component
ItemComponent in GroupComponentPropsitemComponentRename in a custom group component
useLocalizedForm(definition, source, deps)useLocalizedForm(definition, source, { key })Replace deps with { key }
errorSummary was off by defaultThe error summary shows by defaultPass errorSummary={false} to hide it
Focus moved to the first invalid fieldWith two or more errors, focus moves to the error summaryUpdate tests that expect focus on the first field
draftStore was off in FormhausFormA sessionStorage draft without password, file and hidden valuesPass 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.

Old (1.6)New (1.7)Action
useLocalizedForm() from @formhaus/react/i18n or @formhaus/vue/i18nRemovedPass 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.langTranslateSource.locale, requiredRename it
{ translate, prefix, lang }translation({ translate, prefix, locale })Wrap it and rename lang to locale

See Migrate from 1.6.