fix(widget-relation): handle optional configuration (#4256)
This commit is contained in:
parent
6b8fa3fc45
commit
9217e10e06
@ -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')]: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user