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;
|
let metadata;
|
||||||
|
|
||||||
if (Array.isArray(selectedOption)) {
|
if (Array.isArray(selectedOption)) {
|
||||||
this.setState({ initialOptions: selectedOption });
|
this.setState({ initialOptions: selectedOption.filter(Boolean) });
|
||||||
value = selectedOption.map(optionToString);
|
value = selectedOption.map(optionToString);
|
||||||
metadata =
|
metadata =
|
||||||
(!isEmpty(selectedOption) && {
|
(!isEmpty(selectedOption) && {
|
||||||
@ -161,7 +161,7 @@ export default class RelationControl extends React.Component {
|
|||||||
{};
|
{};
|
||||||
onChange(fromJS(value), metadata);
|
onChange(fromJS(value), metadata);
|
||||||
} else {
|
} else {
|
||||||
this.setState({ initialOptions: [selectedOption] });
|
this.setState({ initialOptions: [selectedOption].filter(Boolean) });
|
||||||
value = optionToString(selectedOption);
|
value = optionToString(selectedOption);
|
||||||
metadata = selectedOption && {
|
metadata = selectedOption && {
|
||||||
[field.get('name')]: {
|
[field.get('name')]: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user