Skip to content

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

Open
@gr2m

Description

@gr2m
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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions