@modular-forms/qwik
Version:
The modular and type-safe form library for Qwik
13 lines (12 loc) • 407 B
JavaScript
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 =
dirty ||
getFieldAndArrayStores(form).some((fieldOrFieldArray) => fieldOrFieldArray.active && fieldOrFieldArray.dirty);
}