From 4db497b49696d4118f3cda06a244092c1a49fd17 Mon Sep 17 00:00:00 2001 From: Bartholomew Date: Tue, 26 Mar 2019 17:04:48 +0100 Subject: [PATCH] fix: broken preview (#2245) --- .../src/components/Editor/EditorControlPane/Widget.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js index e7963e98..c05de96d 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorControlPane/Widget.js @@ -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() {