import React from 'react';
import Input from 'react-input-mask';
import { deepEqual } from '../../../util';

module.exports = {
  shouldComponentUpdate: function(nextProps, nextState) {
    // If a new value is set within state, re-render.
    if (this.state && this.state.hasOwnProperty('value') && this.state.value !== nextState.value) {
      return true;
    }

    // If a new value is passed in, re-render.
    if (this.props.value !== nextProps.value) {
      return true;
    }

    // If the component definition change, re-render.
    if (!deepEqual(this.props.component, nextProps.component)) {
      return true;
    }

    return false;
  }
};

import React from 'react';
import Input from 'react-input-mask';
import { deepEqual } from '../../../util';

module.exports = {
  shouldComponentUpdate: function(nextProps, nextState) {
    // If a new value is set within state, re-render.
    if (this.state && this.state.hasOwnProperty('value') && this.state.value !== nextState.value) {
      return true;
    }

    // If the pristineness changes without a value change, re-render.
    if (this.state && this.state.hasOwnProperty('isPristine') && this.state.isPristine !== nextState.isPristine) {
      return true;
    }
    
    // If a new value is passed in, re-render.
    if (this.props.value !== nextProps.value) {
      return true;
    }

    // If the component definition change, re-render.
    if (!deepEqual(this.props.component, nextProps.component)) {
      return true;
    }

    return false;
  }
};

Enable component update when isPristine changes
Enable component update when isPristine changes

In cases where form values do not change, but the pristineness does (for example, when the form is submitted without any modifications to the fields), the form components would not update to show any validation errors. This is now corrected with this fix.