Skip to content

Unclear error when trying to use instance after .destroy #4339

Closed
@gr2m

Description

@gr2m

We have a failing test in https://github.com/hoodiehq/pouchdb-hoodie-api after upgrading to 4.0.2: hoodiehq/pouchdb-hoodie-api#78

I could track down the issue to this

// run with node.js
var PouchDB = require('pouchdb')
var db = new PouchDB('test', {
  db: require('memdown')
})

// just to make sure the init of the db is finished properly
// this can be left out, it has no effect in that context
db.info()

.then(function () {
  return db.put({
    _id: 'cleanTest'
  })
})

  .then(function () {
    console.log('cleanTest created')
    return db.destroy()
  })

  .then(function () {
    console.log('db removed')

    // PROBLEM:
    // this one does never settles settled.
    return db.get('cleanTest')
  })

  .then(function () {
    console.log('.then called after db.get("cleanTest")')
  })
  .catch(function () {
    console.log('.catch called after db.get("cleanTest")')
  })

It's very odd. The node script ends without either calling neither .then or .catch at the end. How is that even possible?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions