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.
@@ -14666,7 +14666,7 @@ var StreamChat = class _StreamChat {
14666
14666
  return this.userAgent;
14667
14667
  }
14668
14668
  if (!this.cachedUserAgent) {
14669
- const version = "9.50.2";
14669
+ const version = "9.50.3";
14670
14670
  const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
14671
14671
  const { name: appName, version: appVersion } = this.appIdentifier ?? {};
14672
14672
  const { os, model: deviceModel } = this.deviceIdentifier ?? {};
@@ -18250,10 +18250,22 @@ var OfflineDBSyncManager = class {
18250
18250
  */
18251
18251
  this.invokeSyncStatusListeners = async (status) => {
18252
18252
  this.syncStatus = status;
18253
- this.syncStatusListeners.forEach((l) => l(status));
18253
+ this.syncStatusListeners.forEach((l) => {
18254
+ try {
18255
+ l(status);
18256
+ } catch (error) {
18257
+ console.log("Error in a sync status listener.", error);
18258
+ }
18259
+ });
18254
18260
  if (status) {
18255
18261
  const promises = Array.from(this.scheduledSyncStatusCallbacks.values()).map(
18256
- (cb) => cb()
18262
+ async (cb) => {
18263
+ try {
18264
+ await cb();
18265
+ } catch (error) {
18266
+ console.log("Error executing a scheduled sync status callback.", error);
18267
+ }
18268
+ }
18257
18269
  );
18258
18270
  await Promise.all(promises);
18259
18271
  this.scheduledSyncStatusCallbacks.clear();
@@ -18315,10 +18327,25 @@ var OfflineDBSyncManager = class {
18315
18327
  };
18316
18328
  /**
18317
18329
  * Executes any tasks that were queued while offline and then performs a sync.
18330
+ *
18331
+ * Each step is isolated so a failure in one does not prevent the other, and
18332
+ * neither can escape to the callers (init + the connection.changed handler).
18333
+ * This guarantees the subsequent invokeSyncStatusListeners(true) always runs,
18334
+ * so syncStatus recovers to true and gated channel queries are unblocked.
18335
+ * Failed syncs degrade to "possibly stale data until the next query" rather
18336
+ * than freezing all future queries. See issue #1816.
18318
18337
  */
18319
18338
  this.syncAndExecutePendingTasks = async () => {
18320
- await this.offlineDb.executePendingTasks();
18321
- await this.sync();
18339
+ try {
18340
+ await this.offlineDb.executePendingTasks();
18341
+ } catch (error) {
18342
+ console.log("Error executing pending tasks during sync.", error);
18343
+ }
18344
+ try {
18345
+ await this.sync();
18346
+ } catch (error) {
18347
+ console.log("Error while syncing the DB.", error);
18348
+ }
18322
18349
  };
18323
18350
  this.client = client;
18324
18351
  this.offlineDb = offlineDb;