diff --git a/packages/netlify-cms-widget-relation/src/RelationControl.js b/packages/netlify-cms-widget-relation/src/RelationControl.js index 0985dbf9..bc52d8c0 100644 --- a/packages/netlify-cms-widget-relation/src/RelationControl.js +++ b/packages/netlify-cms-widget-relation/src/RelationControl.js @@ -148,7 +148,7 @@ export default class RelationControl extends React.Component { let metadata; if (Array.isArray(selectedOption)) { - this.setState({ initialOptions: selectedOption }); + this.setState({ initialOptions: selectedOption.filter(Boolean) }); value = selectedOption.map(optionToString); metadata = (!isEmpty(selectedOption) && { @@ -161,7 +161,7 @@ export default class RelationControl extends React.Component { {}; onChange(fromJS(value), metadata); } else { - this.setState({ initialOptions: [selectedOption] }); + this.setState({ initialOptions: [selectedOption].filter(Boolean) }); value = optionToString(selectedOption); metadata = selectedOption && { [field.get('name')]: {