Values & loading
Initialize the structure first. Populate every value before evaluation.
<Tungsten
schema={schema}
initialValues={{ 'contact.name': 'Ada', people: [{ name: 'Grace' }] }}
onStateChange={({ values, state, valid }) => inspect(values, state, valid)}
onSubmit={(values) => save(values)}
/>InitialValues is optional and defaults to null. Null loads schema defaults, then type defaults. Missing scalar values default to null. Explicit null, false, zero and empty strings are preserved according to field type; they are not treated as missing.
Changing initialValues replaces meaningful data. Presentation-only schema changes with equal initial data preserve edits and repeater membership. Keep schema and values object identities stable between unrelated renders.
Atomic loading
Unknown keys, incompatible types, malformed arrays and invalid references reject loading atomically. Validator errors retain editable values. Eligible children validate, including inactive sections; hidden and disabled children do not block. Templates and defaults are checked even with zero instances.
What is state?
State has fields with value, hidden and errors, plus repeaters with length, bounds, operation availability and instance metadata. Values contains only meaningful field data. Selected tabs and steps are local UI state.
OnStateChange runs after completed initialization/evaluation, including invalid data. OnSubmit runs only when core validation succeeds, and receives values captured from that validated snapshot.