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.
@@ -14850,7 +14850,7 @@ var StreamChat = class _StreamChat {
14850
14850
  return this.userAgent;
14851
14851
  }
14852
14852
  if (!this.cachedUserAgent) {
14853
- const version = "9.50.2";
14853
+ const version = "9.50.3";
14854
14854
  const { name: sdkName, version: sdkVersion } = this.sdkIdentifier ?? {};
14855
14855
  const { name: appName, version: appVersion } = this.appIdentifier ?? {};
14856
14856
  const { os, model: deviceModel } = this.deviceIdentifier ?? {};
@@ -18434,10 +18434,22 @@ var OfflineDBSyncManager = class {
18434
18434
  */
18435
18435
  this.invokeSyncStatusListeners = async (status) => {
18436
18436
  this.syncStatus = status;
18437
- this.syncStatusListeners.forEach((l) => l(status));
18437
+ this.syncStatusListeners.forEach((l) => {
18438
+ try {
18439
+ l(status);
18440
+ } catch (error) {
18441
+ console.log("Error in a sync status listener.", error);
18442
+ }
18443
+ });
18438
18444
  if (status) {
18439
18445
  const promises = Array.from(this.scheduledSyncStatusCallbacks.values()).map(
18440
- (cb) => cb()
18446
+ async (cb) => {
18447
+ try {
18448
+ await cb();
18449
+ } catch (error) {
18450
+ console.log("Error executing a scheduled sync status callback.", error);
18451
+ }
18452
+ }
18441
18453
  );
18442
18454
  await Promise.all(promises);
18443
18455
  this.scheduledSyncStatusCallbacks.clear();
@@ -18499,10 +18511,25 @@ var OfflineDBSyncManager = class {
18499
18511
  };
18500
18512
  /**
18501
18513
  * Executes any tasks that were queued while offline and then performs a sync.
18514
+ *
18515
+ * Each step is isolated so a failure in one does not prevent the other, and
18516
+ * neither can escape to the callers (init + the connection.changed handler).
18517
+ * This guarantees the subsequent invokeSyncStatusListeners(true) always runs,
18518
+ * so syncStatus recovers to true and gated channel queries are unblocked.
18519
+ * Failed syncs degrade to "possibly stale data until the next query" rather
18520
+ * than freezing all future queries. See issue #1816.
18502
18521
  */
18503
18522
  this.syncAndExecutePendingTasks = async () => {
18504
- await this.offlineDb.executePendingTasks();
18505
- await this.sync();
18523
+ try {
18524
+ await this.offlineDb.executePendingTasks();
18525
+ } catch (error) {
18526
+ console.log("Error executing pending tasks during sync.", error);
18527
+ }
18528
+ try {
18529
+ await this.sync();
18530
+ } catch (error) {
18531
+ console.log("Error while syncing the DB.", error);
18532
+ }
18506
18533
  };
18507
18534
  this.client = client;
18508
18535
  this.offlineDb = offlineDb;