ng-pouchdb
ng-pouchdb copied to clipboard
Changes listener does not remove last item of collection
I don't know why this happens, but i deleted the last item of a collection using the couchdb web interface.
Strangely the browser seems to skip the removeChild command in the following block:
} else if (collection.length && indexes[change.id]) { //DELETE
removeChild(change.id);
updateIndexes(indexes[change.id]);
}
Happened on Firefox 38.0 on CentOS.
Replacing the condition with collection.length && (indexes[change.id] != undefined) fixes the issue.
Additional info: When adding the fix from issue #6 it will still not remove the last item in the collection.