Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.add after api.clear does not resolve or reject #94

Open
gr2m opened this issue Dec 27, 2015 · 0 comments
Open

api.add after api.clear does not resolve or reject #94

gr2m opened this issue Dec 27, 2015 · 0 comments
Labels

Comments

@gr2m
Copy link
Member

gr2m commented Dec 27, 2015

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)

@gr2m gr2m added the bug label Dec 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant