fix(widget-list): when single field value is object widget (#2387)

* fix list widget field

* ignore sub list widget
This commit is contained in:
Bartholomew 2019-11-07 20:33:40 +01:00 committed by Shawn Erquhart
parent 002cdd77a8
commit 90748ff4fe

View File

@ -245,8 +245,11 @@ export default class ListControl extends React.Component {
return (fieldName, newValue, newMetadata) => { return (fieldName, newValue, newMetadata) => {
const { value, metadata, onChange, field } = this.props; const { value, metadata, onChange, field } = this.props;
const collectionName = field.get('name'); const collectionName = field.get('name');
const newObjectValue = const listFieldObjectWidget = field.getIn(['field', 'widget']) === 'object';
this.getValueType() !== valueTypes.SINGLE const withNameKey =
this.getValueType() !== valueTypes.SINGLE ||
(this.getValueType() === valueTypes.SINGLE && listFieldObjectWidget);
const newObjectValue = withNameKey
? this.getObjectValue(index).set(fieldName, newValue) ? this.getObjectValue(index).set(fieldName, newValue)
: newValue; : newValue;
const parsedMetadata = { const parsedMetadata = {