Skip to content

use/useModelInitialValues ​

Overview ​

Derives sensible initial values for each field of a model based on field type mappings, supporting both create and edit scenarios.

Methods ​

  • getFieldInitialValue - Returns the initial value for a field based on its type and model, or undefined for many-relations.
  • mergeModelInitialValuesMappings - Merge custom field initial value mappings into the default set used for forms.
  • useModelFilterInitialValues - Returns the initial values for the filters of a model, so that a blank form can be created, without fields being mutated immediately by coercion of values, causing a form to be dirty.
  • useModelInitialValues - Returns the initial values for a model, so that a blank form can be created, without fields being mutated immediately by coercion of values, causing a form to be dirty.

Types ​

InitialValues ​

InitialValues = DeepReadonly

Source ​

client/lib/use/useModelInitialValues.js:1