fix: broken preview (#2245)

This commit is contained in:
Bartholomew 2019-03-26 17:04:48 +01:00 committed by Shawn Erquhart
parent c3374a540a
commit 4db497b496

View File

@ -194,7 +194,10 @@ export default class Widget extends Component {
*/
onChangeObject = (fieldName, newValue, newMetadata) => {
const newObjectValue = this.getObjectValue().set(fieldName, newValue);
return this.props.onChange(newObjectValue, { [this.props.field.get('name')]: newMetadata });
return this.props.onChange(
newObjectValue,
newMetadata && { [this.props.field.get('name')]: newMetadata },
);
};
render() {