@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 +7 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +7 -4
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +2 -2
- package/lib/src/worker/sync/SharedSyncImplementation.js +7 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1786,11 +1786,14 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
1786
1786
|
return () => { };
|
|
1787
1787
|
}
|
|
1788
1788
|
for (const closeListener of trackedPort.closeListeners) {
|
|
1789
|
-
closeListener();
|
|
1789
|
+
await closeListener();
|
|
1790
1790
|
}
|
|
1791
1791
|
if (this.dbAdapter && this.dbAdapter == trackedPort.db) {
|
|
1792
1792
|
// Unconditionally close the connection because the database it's writing to has just been closed.
|
|
1793
|
-
|
|
1793
|
+
// The connection has been closed previously, this might throw. We should be able to ignore it.
|
|
1794
|
+
await this.connectionManager
|
|
1795
|
+
.disconnect()
|
|
1796
|
+
.catch((ex) => this.logger.warn('Error while disconnecting. Will attempt to reconnect.', ex));
|
|
1794
1797
|
// Clearing the adapter will result in a new one being opened in connect
|
|
1795
1798
|
this.dbAdapter = null;
|
|
1796
1799
|
if (shouldReconnect) {
|
|
@@ -1919,9 +1922,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
1919
1922
|
// that and ensure pending requests are aborted when the tab is closed.
|
|
1920
1923
|
remoteCanCloseUnexpectedly: true
|
|
1921
1924
|
});
|
|
1922
|
-
lastClient.closeListeners.push(() => {
|
|
1925
|
+
lastClient.closeListeners.push(async () => {
|
|
1923
1926
|
this.logger.info('Aborting open connection because associated tab closed.');
|
|
1924
|
-
wrapped.close();
|
|
1927
|
+
await wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
|
|
1925
1928
|
wrapped.markRemoteClosed();
|
|
1926
1929
|
});
|
|
1927
1930
|
return wrapped;
|