stream-chat 9.43.0 → 9.43.1

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.
@@ -3275,7 +3275,7 @@ var _AttachmentManager = class _AttachmentManager {
3275
3275
  this.setCustomUploadFn = (doUploadRequest) => {
3276
3276
  this.composer.updateConfig({ attachments: { doUploadRequest } });
3277
3277
  };
3278
- this.cancelAttachmentUploads = (attachments) => {
3278
+ this.cancelAttachmentUploads = (attachments = this.attachments) => {
3279
3279
  for (const { localMetadata } of attachments) {
3280
3280
  this.client.uploadManager.deleteUploadRecord(localMetadata.id);
3281
3281
  }
@@ -3293,7 +3293,6 @@ var _AttachmentManager = class _AttachmentManager {
3293
3293
  };
3294
3294
  };
3295
3295
  this.initState = ({ message } = {}) => {
3296
- this.cancelAttachmentUploads(this.attachments);
3297
3296
  this.state.next(initState({ message }));
3298
3297
  };
3299
3298
  this.getSnapshot = () => {
@@ -4160,7 +4159,9 @@ var applyCommandActivationEffect = (effect, composer) => {
4160
4159
  selection: { start: 0, end: 0 },
4161
4160
  text: ""
4162
4161
  });
4162
+ const attachmentsToCancel = composer.attachmentManager.attachments;
4163
4163
  composer.attachmentManager.initState();
4164
+ composer.attachmentManager.cancelAttachmentUploads(attachmentsToCancel);
4164
4165
  composer.linkPreviewsManager.initState();
4165
4166
  composer.locationComposer.initState();
4166
4167
  composer.pollComposer.initState();
@@ -10455,8 +10456,9 @@ var StableWSConnection = class {
10455
10456
  this.onmessage = (wsID, event) => {
10456
10457
  if (this.wsID !== wsID) return;
10457
10458
  this._log("onmessage() - onmessage callback", { event, wsID });
10458
- const data = typeof event.data === "string" ? JSON.parse(event.data) : null;
10459
- if (!this.isResolved && data) {
10459
+ if (typeof event.data !== "string") return;
10460
+ const data = JSON.parse(event.data);
10461
+ if (!this.isResolved) {
10460
10462
  this.isResolved = true;
10461
10463
  if (data.error) {
10462
10464
  this.rejectPromise?.(this._errorFromWSEvent(data, false));
@@ -10466,10 +10468,10 @@ var StableWSConnection = class {
10466
10468
  this._setHealth(true);
10467
10469
  }
10468
10470
  this.lastEvent = /* @__PURE__ */ new Date();
10469
- if (data && data.type === "health.check") {
10471
+ if (data.type === "health.check") {
10470
10472
  this.scheduleNextPing();
10471
10473
  }
10472
- this.client.handleEvent(event);
10474
+ this.client.dispatchEvent(data);
10473
10475
  this.scheduleConnectionCheck();
10474
10476
  };
10475
10477
  this.onclose = (wsID, event) => {
@@ -13572,11 +13574,6 @@ var StreamChat = class _StreamChat {
13572
13574
  method: `handleEvent;${event.type}`
13573
13575
  });
13574
13576
  };
13575
- this.handleEvent = (messageEvent) => {
13576
- const jsonString = messageEvent.data;
13577
- const event = JSON.parse(jsonString);
13578
- this.dispatchEvent(event);
13579
- };
13580
13577
  /**
13581
13578
  * Updates the members, watchers and read references of the currently active channels that contain this user
13582
13579
  *
@@ -15664,7 +15661,7 @@ var StreamChat = class _StreamChat {
15664
15661
  if (this.userAgent) {
15665
15662
  return this.userAgent;
15666
15663
  }
15667
- const version = "9.43.0";
15664
+ const version = "9.43.1";
15668
15665
  const clientBundle = "browser-cjs";
15669
15666
  let userAgentString = "";
15670
15667
  if (this.sdkIdentifier) {