jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.29k stars 353 forks source link

Not able to close a database connection so a new version connection may be established #173

Closed kuhlaid closed 4 years ago

kuhlaid commented 4 years ago

I'm not able to find an equivalent to db.close() in this plugin. I'm assuming the plugin overrides the db.close() method since I'm not able to use it.

I need to be able to close my connection manually and reestablish a new connection version within the same session. Is there some function I'm missing within the plugin? I searched the plugin code and was not able to find anything similar to close the connection.

jakearchibald commented 4 years ago

db.close() exists and the test suite makes extensive use of it https://github.com/jakearchibald/idb/blob/master/test/open.ts#L17.

Please reopen this issue when you have a minimal reproducible example of the problem you have.

https://stackoverflow.com/help/minimal-reproducible-example

kuhlaid commented 4 years ago

Sorry, after some further testing the db.close() method is useless to me anyway since the browser will not release the connection and allow a new connection within the same app session. I am forced to close the browser tab to destroy the connection (or destroy the session within developer tools). I sent a request to Chrome developers to have this feature added to indexeddb (as it seems to be a rather crucial feature).

jakearchibald commented 4 years ago

The database connection will close and allow a new connection (without closing the tab). But all connections to the database must close before another can be opened.

My tests rely heavily on this behaviour. If you're seeing something different, please create a minimal reproducible example and I'll look into it.