stream-chat 9.50.2 → 9.50.3
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/cjs/index.browser.js +32 -5
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +32 -5
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +32 -5
- package/dist/esm/index.mjs.map +2 -2
- package/dist/types/offline-support/offline_sync_manager.d.ts +7 -0
- package/dist/types/types.d.ts +8 -0
- package/package.json +1 -1
- package/src/offline-support/offline_sync_manager.ts +37 -6
- package/src/types.ts +8 -0
|
@@ -14881,7 +14881,7 @@ var StreamChat = class _StreamChat {
|
|
|
14881
14881
|
return this.userAgent;
|
|
14882
14882
|
}
|
|
14883
14883
|
if (!this.cachedUserAgent) {
|
|
14884
|
-
const version = "9.50.
|
|
14884
|
+
const version = "9.50.3";
|
|
14885
14885
|
const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
|
|
14886
14886
|
const { name: appName, version: appVersion } = this.appIdentifier ?? {};
|
|
14887
14887
|
const { os, model: deviceModel } = this.deviceIdentifier ?? {};
|
|
@@ -18465,10 +18465,22 @@ var OfflineDBSyncManager = class {
|
|
|
18465
18465
|
*/
|
|
18466
18466
|
this.invokeSyncStatusListeners = async (status) => {
|
|
18467
18467
|
this.syncStatus = status;
|
|
18468
|
-
this.syncStatusListeners.forEach((l) =>
|
|
18468
|
+
this.syncStatusListeners.forEach((l) => {
|
|
18469
|
+
try {
|
|
18470
|
+
l(status);
|
|
18471
|
+
} catch (error) {
|
|
18472
|
+
console.log("Error in a sync status listener.", error);
|
|
18473
|
+
}
|
|
18474
|
+
});
|
|
18469
18475
|
if (status) {
|
|
18470
18476
|
const promises = Array.from(this.scheduledSyncStatusCallbacks.values()).map(
|
|
18471
|
-
(cb) =>
|
|
18477
|
+
async (cb) => {
|
|
18478
|
+
try {
|
|
18479
|
+
await cb();
|
|
18480
|
+
} catch (error) {
|
|
18481
|
+
console.log("Error executing a scheduled sync status callback.", error);
|
|
18482
|
+
}
|
|
18483
|
+
}
|
|
18472
18484
|
);
|
|
18473
18485
|
await Promise.all(promises);
|
|
18474
18486
|
this.scheduledSyncStatusCallbacks.clear();
|
|
@@ -18530,10 +18542,25 @@ var OfflineDBSyncManager = class {
|
|
|
18530
18542
|
};
|
|
18531
18543
|
/**
|
|
18532
18544
|
* Executes any tasks that were queued while offline and then performs a sync.
|
|
18545
|
+
*
|
|
18546
|
+
* Each step is isolated so a failure in one does not prevent the other, and
|
|
18547
|
+
* neither can escape to the callers (init + the connection.changed handler).
|
|
18548
|
+
* This guarantees the subsequent invokeSyncStatusListeners(true) always runs,
|
|
18549
|
+
* so syncStatus recovers to true and gated channel queries are unblocked.
|
|
18550
|
+
* Failed syncs degrade to "possibly stale data until the next query" rather
|
|
18551
|
+
* than freezing all future queries. See issue #1816.
|
|
18533
18552
|
*/
|
|
18534
18553
|
this.syncAndExecutePendingTasks = async () => {
|
|
18535
|
-
|
|
18536
|
-
|
|
18554
|
+
try {
|
|
18555
|
+
await this.offlineDb.executePendingTasks();
|
|
18556
|
+
} catch (error) {
|
|
18557
|
+
console.log("Error executing pending tasks during sync.", error);
|
|
18558
|
+
}
|
|
18559
|
+
try {
|
|
18560
|
+
await this.sync();
|
|
18561
|
+
} catch (error) {
|
|
18562
|
+
console.log("Error while syncing the DB.", error);
|
|
18563
|
+
}
|
|
18537
18564
|
};
|
|
18538
18565
|
this.client = client;
|
|
18539
18566
|
this.offlineDb = offlineDb;
|