---
# System prepended metadata

title: Change log
tags: [zeta-dom-react]

---

---
tags: zeta-dom-react
---

# Change log

## v0.4.7 (2023/6/13)

#### Data view

- <kbd>fix</kbd> latest state not persisted after leaving and traversing back

#### Forms

- <kbd>fix</kbd> `DateField` normalizes value to incorrect date or causes component to update indefinitely when selected date is not in the same timezone as current time due to daylight saving adjustment
- <kbd>fix</kbd> latest statenot persisted after leaving and traversing back


## v0.4.6 (2023/6/7)

#### Utilties

- Add `useSingleton` hook
- Support `AbortSignal` and abortion in `useAsync` [[link]](/Rk3_Cez4RFyniUeMMN0eSA#Abort-signal)
- <kbd>fix</kbd> Callback passed to `useAsync` got invoked twice when component is mounted

#### Forms

- <kbd>fix</kbd> Setting `form.preventLeave` to `false` should unlock form element

## v0.4.5 (2023/5/30)

#### Forms

- Add `form.clear` method
- Stricter condition for `preventLeave`
- <kbd>fix</kbd> `toggleValue` from `MultiChoiceField` has incorrect behavior

## v0.4.4 (2023/5/5)

#### Utilties

- Add `domEventRef` [[link]](/nG1bjWUzQ7Ssjd-Wz4cMPQ#domEventRef)
- Add `emit` method to error handler [[link]](/H4Ay9ZioRB-RuMlU99Geiw#Emit-error)

#### Forms

- Add `form.getErrors` method [[link]](/hm3O3ZvVR0KCsrpDxr44Iw#FormContextgetErrors)
- <kbd>fix</kbd> an bug that could cause page halted with `ChoiceField` [[link]](/i3HSJw6iTDGGT2f8dhC8ug#Choice-field-causing-parent-component-to-update-indefinitely)
- <kbd>fix</kbd> `validateToChange` prop on field level should override form options

## v0.4.3 (2023/4/28) 

#### Utilities

- <kbd>fix</kbd> import error for `useMemoizedFunction` introduced in `v0.4.2`

#### Forms

- <kbd>fix</kbd> value in `form.data` object are not synchronized when setting new value does not actually update the value
- <kbd>fix</kbd> a property named `undefined` is created on `form.data` if an unnamed field is associated to a form context

## v0.4.2 (2023/4/24)

#### Utilities

- `ErrorHandler.catch` now accepts multiple error codes or constructors [[link]](/FH4Ay9ZioRB-RuMlU99Geiw#Selective-handling)

#### Forms

- Add `DateField` [[link]](/GCsLwFamS8SR5GCtENrv1Q#DateField)
- Allow focus to first erreous or empty field
- <kbd>fix</kbd> `autoPersist` flag disabled in dev strict mode
- <kbd>fix</kbd> missing `disabled` in `inputProps` for `TextField`


## v0.4.1 (2023/4/13)

#### Utilities

- <kbd>fix</kbd> `useMediaQuery` did not trigger re-render in dev strict mode

#### Forms

- Add `NumericField` [[link]](/GCsLwFamS8SR5GCtENrv1Q#NumericField)
- Add `ValidationError` and `formatError` for customizing error messages [[link]](/g1sBlRuqTgmVDWxrbAzMKA)
- <kbd>fix</kbd> normalize value to boolean for `ToggleField`

## v0.4.0 (2023/3/29)

#### Utilities

- Add `debounce` param to `useAsync` [[link]](/Rk3_Cez4RFyniUeMMN0eSA#Debounce)

#### Forms

- Support nested data object and array [[link]](/JlrFmnLARd6roNfEjIbxhQ)
- Add static method `FormContext.get` [[link]](/hm3O3ZvVR0KCsrpDxr44Iw%23FormContext-class#static-FormContextget)
- Add overload `FormContext.element` and `FormContext.focus` method
- `FormContext.focus` method now returns a boolean whether focus is set
- <kbd>fix</kbd> field not working properly in dev strict mode
- <kbd>fix</kbd> `FormContext.validate` method should return `false` when a required field is empty
- <kbd>fix</kbd> `FormContext.validate` method should not validate disabled field

## v0.3.11 (2023/2/18)

#### Forms

- Add `defaultValue` and `normalizeValue` to field type
- <kbd>fix</kbd> `onChange` should be called with current value when resetting form
- <kbd>fix</kbd> `onChange` are not called when no form context

## v0.3.10 (2023/2/3)

#### Utilities

- <kbd>fix</kbd> Incorrect initial state for `useAsync` when `autoload` is false
- <kbd>fix</kbd> Issue with strict mode in React 18

#### Forms

- <kbd>fix</kbd> Type inference issue
- <kbd>fix</kbd> Value for controlled field cannot be updated

## v0.3.8 (2023/1/17)

#### Forms

- <kbd>feat</kbd> Add `FormContext.getError` method
- <kbd>fix</kbd>  Unable to create property on `FormContext.data` with `undefined` value
- <kbd>fix</kbd>  Property being re-created for unrendered field after reset or property is deleted

## v0.3.7 (2023/1/10)

#### Forms

- <kbd>fix</kbd> Rerender with correct value for `useFormField` when name is changed
- <kbd>fix</kbd> Reset error state for `useFormField` when name is changed
- <kbd>fix</kbd> Prevent from leaving if `beforeLeave` event is not handled

## v0.3.6 (2022/12/21)

#### Forms

- <kbd>feat</kbd> Add `FormFieldProps.clearWhenUnmount`
- <kbd>fix</kbd> Trigger `dataChange` event when property is created on or deleted from `FormContext.data`
- <kbd>fix</kbd> Trigger `validationChange` event when passing error by field props
- <kbd>fix</kbd> Prevent component update after unmount when using `useFormContext`

## v0.3.5 (2022/11/19)

#### Forms

- <kbd>feat</kbd> Add `preventLeave` option
- <kbd>feat</kbd> New way to define custom field types
- <kbd>fix</kbd> `dataChange` event may report duplicated keys

## v0.3.4 (2022/11/11)

#### Utilities

- <kbd>feat</kbd> Add `useUpdateTrigger`
- <kbd>fix</kbd> Unnecessary effect execution in `useBreakpoint`

#### Forms

- <kbd>feat</kbd> Add `FormContext.toJSON` method
- <kbd>feat</kbd> Handle native form `reset` event
- <kbd>feat</kbd> Add optional `FormFieldProps.label` prop
- <kbd>fix</kbd> Force component update after reset
- <kbd>fix</kbd> Incorrect `isValid` state after reset
- <kbd>fix</kbd> Setting error by `error` prop or `FormContext.setError` should invalidate form

## v0.3.3 (2022/11/3)

#### Forms

- <kbd>feat</kbd> Add `FormContext.ref`
- <kbd>feat</kbd> Update default `isEmpty` condition, and allow to override by field types

### Miscellanous

- <kbd>fix</kbd> Expose correct file in unpkg

## v0.3.2 (2022/8/24)

#### Utilities

- <kbd>feat</kbd> Add `useErrorHandler` replacing `useErrorHandlerRef`
- <kbd>feat</kbd> Emit `load` event from `useAsync`
- <kbd>fix</kbd> Forward `error` event to `zeta.dom` from `useAsync` if it is not handled
- <kbd>fix</kbd>  Component will be rerendered when loading starts 

#### Forms

- <kbd>feat</kbd> Add `Form` component for rendering `<form>` element
- <kbd>feat</kbd> Add `enterKeyHint` options for `FormContext`
- <kbd>feat</kbd> Add field type for extensibility
- <kbd>feat</kbd> Expose current form object in `FormFieldState.form`

## v0.3.1 (2022/8/4)

#### Utilities

- <kbd>feat</kbd> Add `innerTextOrHTML` and `withSuspense`
- <kbd>fix</kbd>  Reduce component rerendering by `useAsync`

#### Forms

- <kbd>fix</kbd> `onChange` callback should be called for uncontrolled field

## v0.3.0 (2022/7/18)

#### Data view

- **Breaking change:** `DataView.getView` no longer reverse item orderings for the array returned from callback when `sortOrder` is `desc`; the callback must handle the descending order manually 
- <kbd>feat</kbd> Add `DataView.sort` method
- <kbd>fix</kbd>  `viewChange` event was not emitted when `DataView` was not created in by `useDataView` hook
- <kbd>fix</kbd>  Maintain previous order unchanged for items in the same order in new sorting logic
  > For example given an array of items [A,B,C,D,E] that is currently sorted as [E,B,D,C,A], then for a new sorting logic that results in [E>B=C=D>A], the result ordering should be [E,B,D,C,A]; in the sense that [B,D,C] remains their order unchanged.
- <kbd>fix</kbd> `DataView.getView` should sort items if callback is not supplied

#### Forms

- <kbd>feat</kbd> Add `FormContext.setError` method