import { Actions , MarkAsPristineAction } from '../../actions' ; import { computeArrayState , FormArrayState } from '../../state' ; import { childReducer , dispatchActionPerChild } from './util' ; export function markAsPristineReducer < TValue > ( state , action ) { if ( action . type !== MarkAsPristineAction . TYPE ) { return state ; } if ( action . controlId !== state . id ) { return childReducer ( state , action ) ; } if ( state . isPristine ) { return state ; } return computeArrayState ( state . id , dispatchActionPerChild ( state . controls , controlId => new MarkAsPristineAction ( controlId ) ) , state . value , state . errors , state . pendingValidations , state . userDefinedProperties , { wasOrShouldBeDirty : false , wasOrShouldBeEnabled : state . isEnabled , wasOrShouldBeTouched : state . isTouched , wasOrShouldBeSubmitted : state . isSubmitted , } ) ; }