import { Actions , SetUserDefinedPropertyAction } from '../../actions' ; import { FormGroupState , KeyValue } from '../../state' ; import { childReducer } from './util' ; export function setUserDefinedPropertyReducer < TValue extends KeyValue > ( state , action ) { if ( action . type !== SetUserDefinedPropertyAction . TYPE ) { return state ; } if ( action . controlId !== state . id ) { return childReducer ( state , action ) ; } if ( state . userDefinedProperties [ action . name ] === action . value ) { return state ; } return { ... state , userDefinedProperties : { ... state . userDefinedProperties , [ action . name ] : action . value , } , } ; }