yjs / y-indexeddb

IndexedDB database adapter for Yjs
https://docs.yjs.dev/ecosystem/database-provider/y-indexeddb
Other
196 stars 30 forks source link

ClearData does not return a Promise #12

Closed mikkokam closed 3 years ago

mikkokam commented 3 years ago

I was purging an ever-growing IndexedDB database occasionally - trying to use await indexeddbProvider.clearData(); as the documentation says provider.clearData(): Promise.

Typescript rightfully reports:

'await' has no effect on the type of this expression.ts(80007)

/**
   * Destroys this instance and removes all data from indexeddb.
   */
  clearData () {
    this.destroy().then(() => {
      idb.deleteDB(this.name)
    })
  }

Maybe this would fix it:

/**
   * Destroys this instance and removes all data from indexeddb.
   */
  clearData () {
    return this.destroy().then(() => {
      idb.deleteDB(this.name)
    })
  }
dmonad commented 3 years ago

Right, thanks for opening a ticket!

Fixed in 9.0.6