Do not call onDrop if newIndex is null

This commit is contained in:
Paul Kaplan committed 2018-06-19 16:29:35 -04:00
1 parent 417e439a38
commit e1aa283fc9
1 file changed
+4 -2
+4 -2
View File
@@ -26,8 +26,10 @@ const SortableHOC = function (WrappedComponent) {
return a.top - b.top;
});
} else if (!newProps.dragInfo.dragging && this.props.dragInfo.dragging) {
this.props.onDrop(Object.assign({},
this.props.dragInfo, {newIndex: this.getMouseOverIndex()}));
const newIndex = this.getMouseOverIndex();
if (newIndex !== null) {
this.props.onDrop(Object.assign({}, this.props.dragInfo, {newIndex}));
}
}
}