]> git.wincent.com - hextrapolate.git/commitdiff
Only replace validators when base changes
authorGreg Hurrell <greg@hurrell.net>
Thu, 1 Jun 2017 14:05:06 +0000 (07:05 -0700)
committerGreg Hurrell <greg@hurrell.net>
Thu, 1 Jun 2017 14:05:06 +0000 (07:05 -0700)
Which is rare (only when user selects a new one from one of the dynamic
field drop-downs).

src/Field.react.js

index b7b3ebda775f8d20bf2437f2664d98682d518de0..4b1fa4a7b5c6ac49228daba36b60dbef3d726fed 100644 (file)
@@ -63,7 +63,9 @@ export default class Field extends React.Component {
   }
 
   componentWillReceiveProps(nextProps) {
-    this._validator = getValidator(nextProps.base);
+    if (nextProps.base !== this.props.base) {
+      this._validator = getValidator(nextProps.base);
+    }
   }
 
   _isValid(value: string): boolean {