UNPKG

@modular-forms/react

Version:

The modular and type-safe form library for React

13 lines (12 loc) 427 B
import { getFieldAndArrayStores } from './getFieldAndArrayStores'; /** * Updates the dirty state of the form. * * @param form The store of the form. * @param dirty Whether dirty state is true. */ export function updateFormDirty(form, dirty) { form.dirty.value = dirty || getFieldAndArrayStores(form).some((fieldOrFieldArray) => fieldOrFieldArray.active.peek() && fieldOrFieldArray.dirty.peek()); }