pouchdb-hoodie-api
pouchdb-hoodie-api copied to clipboard
api.add after api.clear does not resolve or reject
var PouchDB = require('pouchdb').defaults({db: require('memdown')})
PouchDB.plugin(require('.'))
var db = new PouchDB('foo')
var api = db.hoodieApi()
api.clear()
.then(function () {
console.log('cleared')
return api.add({})
})
.then(console.log)
.catch(console.log)
This code logs 'cleared'
, but the promise from api.add({})
remains pending.
Note that once db.destroy()
is called, the db instance cannot be used anymore. We have to unbind all event handlers and replace state.db
with a new instance (here)