a-plus-forms
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -90,2 +90,4 @@ 'use strict'; | ||
value: function componentWillUnmount() { | ||
this.isUnmounted = true; | ||
if (this.context.APFState) { | ||
@@ -100,2 +102,6 @@ this.context.APFState.unregister(this); | ||
this.value = props.value; | ||
} else if ('defaultValue' in props) { | ||
if (JSON.stringify(props.defaultValue) !== JSON.stringify(this.props.defaultValue)) { | ||
this.stateManager.value = props.defaultValue; | ||
} | ||
} | ||
@@ -102,0 +108,0 @@ } |
@@ -72,3 +72,5 @@ 'use strict'; | ||
set: function set(value) { | ||
this.component.setState({ value: value }); | ||
if (!this.component.isUnmounted) { | ||
this.component.setState({ value: value }); | ||
} | ||
} | ||
@@ -102,4 +104,7 @@ }]); | ||
this.fields.push(field); | ||
this.component.forceUpdate(); // re-render in case of errors were re-picked up | ||
if (!this.component.isUnmounted) { | ||
this.component.forceUpdate(); // re-render in case of errors were re-picked up | ||
} | ||
if (field.name && field.name in this.seedValues) { | ||
@@ -106,0 +111,0 @@ field.stateManager.value = this.seedValues[field.name]; |
{ | ||
"name": "a-plus-forms", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "A+ forms. Would use again", | ||
@@ -12,6 +12,6 @@ "files": [ | ||
"lint": "eslint src test && flow", | ||
"build": "babel src --out-dir dist/", | ||
"build": "NODE_ENV=production babel src --out-dir dist/", | ||
"precommit": "lint-staged", | ||
"prepush": "npm run test", | ||
"prepare": "NODE_ENV=production npm run build" | ||
"prepare": "npm run build" | ||
}, | ||
@@ -18,0 +18,0 @@ "lint-staged": { |
99465
1546