fix: remove empty list item (#3245)

This commit is contained in:
Bartholomew 2020-02-13 10:59:38 +01:00 committed by GitHub
parent 2447f9c311
commit f915bf375f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,7 +273,10 @@ export default class ListControl extends React.Component {
const isSingleField = this.getValueType() === valueTypes.SINGLE;
const metadataRemovePath = isSingleField ? value.get(index) : value.get(index).valueSeq();
const parsedMetadata = metadata && { [collectionName]: metadata.removeIn(metadataRemovePath) };
const parsedMetadata =
metadata && !metadata.isEmpty()
? { [collectionName]: metadata.removeIn(metadataRemovePath) }
: metadata;
// Removed item object index is the last item in the list
const removedItemIndex = value.count() - 1;