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.
@@ -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.2";
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) => l(status));
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) => 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
- await this.offlineDb.executePendingTasks();
18536
- await this.sync();
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;