Commit 21b52577 authored by Patrik Meijer's avatar Patrik Meijer
Browse files

Move over to getDerivedStateFromProps in attribute item

parent 649062fc
......@@ -58,11 +58,17 @@ export default class AttributeItem extends Component {
state = {
value: this.props.value,
persistedValue: this.props.value,
picking: false,
};
componentWillReceiveProps(nextProps) {
this.setState({value: nextProps.value, picking: false});
static getDerivedStateFromProps(nextProps, prevState) {
// Note that outside property updates have precedence over typed in fields.
if (nextProps.value !== prevState.persistedValue) {
return {value: nextProps.value, persistedValue: nextProps.value, picking: false}
}
return null;
}
onColorChange = (color) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment