API ReferenceReact provider and hooksInterface
IncrementalValidationResult\<P\>
Return type of useIncrementalValidation.
Type Parameters
| Type Parameter |
|---|
P |
Properties
allErrors
readonly allErrors: ValidationIssue[];Convenience: all current errors flattened; empty while error is set.
error
readonly error: unknown;The first infrastructure or cancellation failure from an async rule. This is kept separate from
field issues and cleared when that rule runs again. Existing SDK errors preserve identity,
recognizable provider failures become ProviderConnectionError, and unknown failures become
ContactSupportError with the original rejection as cause. Cancellation preserves its exact abort
reason. validateAll rejects with the same normalized failure instance published here.
fields
readonly fields: Partial<Record<keyof P, FieldValidationState>>;Per-field validation state. Errors are masked while error is set: a rule whose async check fails has its own slot revert to provisional (unevaluated) rather than to a fresh error, so a UI keeps showing the field’s last good state instead of flashing it invalid.
isValid
readonly isValid: boolean;True when all rules for touched fields have resolved with zero issues.
validateAll
readonly validateAll: () => Promise<ValidationIssue[]>;Run all rules eagerly (for submit). Returns collected issues.
Exhaustive like runValidation: a rule whose own errorField is
included in dependsOn and missing reports FieldRequired for that field rather than being
silently skipped, so submit-time results are never a partial verdict. The hook’s per-keystroke
incremental path is unaffected — it keeps deferring a rule silently while its dependencies are
incomplete (gated by areDepsPresent, not by whether the field has been touched). Editing a field
after a validateAll reports it required clears that field’s error like any other form field, even
if the field is still absent (nullish) afterward — clearing a text input to '' is present, not
absent, and typically re-runs the rule with a different result. The next validateAll re-reports
the field if it is still missing (deliberate: conventional form behavior, not a defect).
Returns
Promise<ValidationIssue[]>