Skip to content

Commit

Permalink
fix: handle single values in multiselect relation widget (#7164)
Browse files Browse the repository at this point in the history
  • Loading branch information
demshy authored Apr 2, 2024
1 parent 7c85595 commit 248f36f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/decap-cms-widget-relation/src/RelationControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,16 @@ export default class RelationControl extends React.Component {

//set metadata
this.mounted &&
onChange(filteredValue.length === 1 ? filteredValue[0] : fromJS(filteredValue), {
[field.get('name')]: {
[field.get('collection')]: metadata,
onChange(
filteredValue.length === 1 && !this.isMultiple()
? filteredValue[0]
: fromJS(filteredValue),
{
[field.get('name')]: {
[field.get('collection')]: metadata,
},
},
});
);
}
}

Expand Down

0 comments on commit 248f36f

Please sign in to comment.