ng-pouchdb icon indicating copy to clipboard operation
ng-pouchdb copied to clipboard

Pouch Collection removeChild removes first in collection when no index found

Open daveyjclark opened this issue 10 years ago • 0 comments

When you have a collection with deleted items the removeChild function looks up the index but can return 'undefined'. In this case the call to collection.splice will remove the first item in the list which is not the desired behaviour.

I fixed it for me by checking on index before removing.

// Remove the item from the collection if (index) { collection.splice(index, 1); }

daveyjclark avatar May 29 '15 01:05 daveyjclark