UNPKG

@modular-forms/solid

Version:

The modular and type-safe form library for SolidJS

13 lines (12 loc) 470 B
import { untrack } from 'solid-js'; 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) { untrack(() => form.internal.dirty.set(dirty || getFieldAndArrayStores(form).some((fieldOrFieldArray) => fieldOrFieldArray.active.get() && fieldOrFieldArray.dirty.get()))); }