@powersync/web 0.0.0-dev-20251021113138 → 0.0.0-dev-20251030065540

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -40868,11 +40868,14 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
40868
40868
  return () => { };
40869
40869
  }
40870
40870
  for (const closeListener of trackedPort.closeListeners) {
40871
- closeListener();
40871
+ await closeListener();
40872
40872
  }
40873
40873
  if (this.dbAdapter && this.dbAdapter == trackedPort.db) {
40874
40874
  // Unconditionally close the connection because the database it's writing to has just been closed.
40875
- await this.connectionManager.disconnect();
40875
+ // The connection has been closed previously, this might throw. We should be able to ignore it.
40876
+ await this.connectionManager
40877
+ .disconnect()
40878
+ .catch((ex) => this.logger.warn('Error while disconnecting. Will attempt to reconnect.', ex));
40876
40879
  // Clearing the adapter will result in a new one being opened in connect
40877
40880
  this.dbAdapter = null;
40878
40881
  if (shouldReconnect) {
@@ -41001,9 +41004,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
41001
41004
  // that and ensure pending requests are aborted when the tab is closed.
41002
41005
  remoteCanCloseUnexpectedly: true
41003
41006
  });
41004
- lastClient.closeListeners.push(() => {
41007
+ lastClient.closeListeners.push(async () => {
41005
41008
  this.logger.info('Aborting open connection because associated tab closed.');
41006
- wrapped.close();
41009
+ await wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
41007
41010
  wrapped.markRemoteClosed();
41008
41011
  });
41009
41012
  return wrapped;