stream-chat 9.41.0 → 9.42.0

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.
@@ -138,6 +138,7 @@ __export(index_exports, {
138
138
  ThreadManager: () => ThreadManager,
139
139
  TokenManager: () => TokenManager,
140
140
  UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT: () => UPDATE_LIVE_LOCATION_REQUEST_MIN_THROTTLE_TIMEOUT,
141
+ UploadManager: () => UploadManager,
141
142
  UserFromToken: () => UserFromToken,
142
143
  UserSearchSource: () => UserSearchSource,
143
144
  VALID_MAX_VOTES_VALUE_REGEX: () => VALID_MAX_VOTES_VALUE_REGEX,
@@ -1034,6 +1035,7 @@ var messagePaginationCreatedAtAround = ({
1034
1035
  parentSet,
1035
1036
  requestedPageSize,
1036
1037
  returnedPage,
1038
+ filteredReturnedPage,
1037
1039
  messagePaginationOptions
1038
1040
  }) => {
1039
1041
  const newPagination = { ...parentSet.pagination };
@@ -1066,9 +1068,13 @@ var messagePaginationCreatedAtAround = ({
1066
1068
  hasNext = hasPrev = false;
1067
1069
  updateHasPrev = updateHasNext = true;
1068
1070
  } else {
1071
+ const [firstFilteredPageMsg, lastFilteredPageMsg] = [
1072
+ filteredReturnedPage[0],
1073
+ filteredReturnedPage.slice(-1)[0]
1074
+ ];
1069
1075
  const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [
1070
- firstPageMsg?.id && firstPageMsg.id === parentSet.messages[0]?.id,
1071
- lastPageMsg?.id && lastPageMsg.id === parentSet.messages.slice(-1)[0]?.id
1076
+ firstFilteredPageMsg?.id && firstFilteredPageMsg.id === parentSet.messages[0]?.id,
1077
+ lastFilteredPageMsg?.id && lastFilteredPageMsg.id === parentSet.messages.slice(-1)[0]?.id
1072
1078
  ];
1073
1079
  updateHasPrev = firstPageMsgIsFirstInSet;
1074
1080
  updateHasNext = lastPageMsgIsLastInSet;
@@ -1090,6 +1096,7 @@ var messagePaginationIdAround = ({
1090
1096
  parentSet,
1091
1097
  requestedPageSize,
1092
1098
  returnedPage,
1099
+ filteredReturnedPage,
1093
1100
  messagePaginationOptions
1094
1101
  }) => {
1095
1102
  const newPagination = { ...parentSet.pagination };
@@ -1097,10 +1104,13 @@ var messagePaginationIdAround = ({
1097
1104
  if (!id_around) return newPagination;
1098
1105
  let hasPrev;
1099
1106
  let hasNext;
1100
- const [firstPageMsg, lastPageMsg] = [returnedPage[0], returnedPage.slice(-1)[0]];
1107
+ const [firstFilteredPageMsg, lastFilteredPageMsg] = [
1108
+ filteredReturnedPage[0],
1109
+ filteredReturnedPage.slice(-1)[0]
1110
+ ];
1101
1111
  const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [
1102
- firstPageMsg?.id === parentSet.messages[0]?.id,
1103
- lastPageMsg?.id === parentSet.messages.slice(-1)[0]?.id
1112
+ firstFilteredPageMsg?.id === parentSet.messages[0]?.id,
1113
+ lastFilteredPageMsg?.id === parentSet.messages.slice(-1)[0]?.id
1104
1114
  ];
1105
1115
  let updateHasPrev = firstPageMsgIsFirstInSet;
1106
1116
  let updateHasNext = lastPageMsgIsLastInSet;
@@ -1135,15 +1145,19 @@ var messagePaginationLinear = ({
1135
1145
  parentSet,
1136
1146
  requestedPageSize,
1137
1147
  returnedPage,
1148
+ filteredReturnedPage,
1138
1149
  messagePaginationOptions
1139
1150
  }) => {
1140
1151
  const newPagination = { ...parentSet.pagination };
1141
1152
  let hasPrev;
1142
1153
  let hasNext;
1143
- const [firstPageMsg, lastPageMsg] = [returnedPage[0], returnedPage.slice(-1)[0]];
1154
+ const [firstFilteredPageMsg, lastFilteredPageMsg] = [
1155
+ filteredReturnedPage[0],
1156
+ filteredReturnedPage.slice(-1)[0]
1157
+ ];
1144
1158
  const [firstPageMsgIsFirstInSet, lastPageMsgIsLastInSet] = [
1145
- firstPageMsg?.id && firstPageMsg.id === parentSet.messages[0]?.id,
1146
- lastPageMsg?.id && lastPageMsg.id === parentSet.messages.slice(-1)[0]?.id
1159
+ firstFilteredPageMsg?.id && firstFilteredPageMsg.id === parentSet.messages[0]?.id,
1160
+ lastFilteredPageMsg?.id && lastFilteredPageMsg.id === parentSet.messages.slice(-1)[0]?.id
1147
1161
  ];
1148
1162
  const queriedNextMessages = messagePaginationOptions && (messagePaginationOptions.created_at_after_or_equal || messagePaginationOptions.created_at_after || messagePaginationOptions.id_gt || messagePaginationOptions.id_gte);
1149
1163
  const queriedPrevMessages = typeof messagePaginationOptions === "undefined" ? true : messagePaginationOptions.created_at_before_or_equal || messagePaginationOptions.created_at_before || messagePaginationOptions.id_lt || messagePaginationOptions.id_lte || messagePaginationOptions.offset;
@@ -1163,8 +1177,7 @@ var messagePaginationLinear = ({
1163
1177
  return newPagination;
1164
1178
  };
1165
1179
  var messageSetPagination = (params) => {
1166
- const messagesFilteredLocally = params.returnedPage.filter(({ shadowed }) => shadowed);
1167
- if (params.parentSet.messages.length + messagesFilteredLocally.length < params.returnedPage.length) {
1180
+ if (params.parentSet.messages.length + (params.returnedPage.length - params.filteredReturnedPage.length) < params.returnedPage.length) {
1168
1181
  params.logger?.(
1169
1182
  "error",
1170
1183
  "Corrupted message set state: parent set size < returned page size"
@@ -1511,9 +1524,11 @@ var ChannelState = class {
1511
1524
  addIfDoesNotExist,
1512
1525
  messageSetToAddToIfDoesNotExist
1513
1526
  );
1527
+ const filteredMessageIds = [];
1514
1528
  for (let i = 0; i < messagesToAdd.length; i += 1) {
1515
1529
  const isFromShadowBannedUser = messagesToAdd[i].shadowed;
1516
- if (isFromShadowBannedUser) {
1530
+ if (isFromShadowBannedUser && addIfDoesNotExist) {
1531
+ filteredMessageIds.push(messagesToAdd[i].id);
1517
1532
  continue;
1518
1533
  }
1519
1534
  const isMessageFormatted = messagesToAdd[i].created_at instanceof Date;
@@ -1555,7 +1570,8 @@ var ChannelState = class {
1555
1570
  }
1556
1571
  }
1557
1572
  return {
1558
- messageSet: this.messageSets[targetMessageSetIndex]
1573
+ messageSet: this.messageSets[targetMessageSetIndex],
1574
+ filteredMessageIds
1559
1575
  };
1560
1576
  }
1561
1577
  /**
@@ -3284,11 +3300,11 @@ var _AttachmentManager = class _AttachmentManager {
3284
3300
  return attachments;
3285
3301
  }
3286
3302
  }
3287
- return null;
3303
+ return stateAttachments;
3288
3304
  };
3289
3305
  this.updateAttachment = (attachmentToUpdate) => {
3290
3306
  const updatedAttachments = this.prepareAttachmentUpdate(attachmentToUpdate);
3291
- if (updatedAttachments) {
3307
+ if (updatedAttachments && updatedAttachments !== this.attachments) {
3292
3308
  this.state.partialNext({ attachments: updatedAttachments });
3293
3309
  }
3294
3310
  };
@@ -3298,15 +3314,15 @@ var _AttachmentManager = class _AttachmentManager {
3298
3314
  let hasUpdates = false;
3299
3315
  attachmentsToUpsert.forEach((attachment) => {
3300
3316
  const updatedAttachments = this.prepareAttachmentUpdate(attachment);
3301
- if (updatedAttachments) {
3302
- attachments = updatedAttachments;
3303
- hasUpdates = true;
3304
- } else {
3317
+ if (updatedAttachments === null) {
3305
3318
  const localAttachment = ensureIsLocalAttachment(attachment);
3306
3319
  if (localAttachment) {
3307
3320
  attachments.push(localAttachment);
3308
3321
  hasUpdates = true;
3309
3322
  }
3323
+ } else if (updatedAttachments !== this.attachments) {
3324
+ attachments = updatedAttachments;
3325
+ hasUpdates = true;
3310
3326
  }
3311
3327
  });
3312
3328
  if (hasUpdates) {
@@ -3314,11 +3330,15 @@ var _AttachmentManager = class _AttachmentManager {
3314
3330
  }
3315
3331
  };
3316
3332
  this.removeAttachments = (localAttachmentIds) => {
3333
+ if (!localAttachmentIds.length) return;
3317
3334
  this.state.partialNext({
3318
3335
  attachments: this.attachments.filter(
3319
3336
  (attachment) => !localAttachmentIds.includes(attachment.localMetadata?.id)
3320
3337
  )
3321
3338
  });
3339
+ for (const id of localAttachmentIds) {
3340
+ this.client.uploadManager.deleteUploadRecord(id);
3341
+ }
3322
3342
  };
3323
3343
  this.getUploadConfigCheck = async (fileLike) => {
3324
3344
  const client = this.channel.getClient();
@@ -3407,13 +3427,17 @@ var _AttachmentManager = class _AttachmentManager {
3407
3427
  const percent = progressEvent.lengthComputable && progressEvent.total ? Math.round(progressEvent.loaded * 100 / progressEvent.total) : void 0;
3408
3428
  options.onProgress?.(percent);
3409
3429
  } : void 0;
3430
+ const axiosUploadConfig = progressHandler || options?.abortSignal ? {
3431
+ ...progressHandler ? { onUploadProgress: progressHandler } : {},
3432
+ ...options?.abortSignal ? { signal: options.abortSignal } : {}
3433
+ } : void 0;
3410
3434
  if (isFileReference(fileLike)) {
3411
3435
  return this.channel[isImageFile(fileLike) ? "sendImage" : "sendFile"](
3412
3436
  fileLike.uri,
3413
3437
  fileLike.name,
3414
3438
  fileLike.type,
3415
3439
  void 0,
3416
- progressHandler ? { onUploadProgress: progressHandler } : void 0
3440
+ axiosUploadConfig
3417
3441
  );
3418
3442
  }
3419
3443
  const file = isFile(fileLike) ? fileLike : createFileFromBlobs({
@@ -3421,13 +3445,7 @@ var _AttachmentManager = class _AttachmentManager {
3421
3445
  fileName: generateFileName(fileLike.type),
3422
3446
  mimeType: fileLike.type
3423
3447
  });
3424
- const { duration, ...result } = await this.channel[isImageFile(fileLike) ? "sendImage" : "sendFile"](
3425
- file,
3426
- void 0,
3427
- void 0,
3428
- void 0,
3429
- progressHandler ? { onUploadProgress: progressHandler } : void 0
3430
- );
3448
+ const { duration, ...result } = await this.channel[isImageFile(fileLike) ? "sendImage" : "sendFile"](file, void 0, void 0, void 0, axiosUploadConfig);
3431
3449
  return result;
3432
3450
  };
3433
3451
  /**
@@ -3462,33 +3480,9 @@ var _AttachmentManager = class _AttachmentManager {
3462
3480
  });
3463
3481
  return localAttachment;
3464
3482
  }
3465
- const shouldTrackProgress = this.config.trackUploadProgress;
3466
- const uploadingAttachment = {
3467
- ...attachment,
3468
- localMetadata: {
3469
- ...attachment.localMetadata,
3470
- uploadState: "uploading",
3471
- ...shouldTrackProgress && { uploadProgress: 0 }
3472
- }
3473
- };
3474
- this.upsertAttachments([uploadingAttachment]);
3475
- const uploadOptions = shouldTrackProgress ? {
3476
- onProgress: (percent) => {
3477
- this.updateAttachment({
3478
- ...uploadingAttachment,
3479
- localMetadata: {
3480
- ...uploadingAttachment.localMetadata,
3481
- uploadProgress: percent
3482
- }
3483
- });
3484
- }
3485
- } : void 0;
3486
3483
  let response;
3487
3484
  try {
3488
- response = await this.doUploadRequest(
3489
- localAttachment.localMetadata.file,
3490
- uploadOptions
3491
- );
3485
+ response = await this.upload(attachment);
3492
3486
  } catch (error) {
3493
3487
  const reason = error instanceof Error ? error.message : "unknown error";
3494
3488
  const failedAttachment = {
@@ -3557,31 +3551,10 @@ var _AttachmentManager = class _AttachmentManager {
3557
3551
  this.upsertAttachments([attachment]);
3558
3552
  return preUpload.state.attachment;
3559
3553
  }
3560
- const shouldTrackProgress = this.config.trackUploadProgress;
3561
- attachment = {
3562
- ...attachment,
3563
- localMetadata: {
3564
- ...attachment.localMetadata,
3565
- uploadState: "uploading",
3566
- ...shouldTrackProgress && { uploadProgress: 0 }
3567
- }
3568
- };
3569
- this.upsertAttachments([attachment]);
3570
- const uploadOptions = shouldTrackProgress ? {
3571
- onProgress: (percent) => {
3572
- this.updateAttachment({
3573
- ...attachment,
3574
- localMetadata: {
3575
- ...attachment.localMetadata,
3576
- uploadProgress: percent
3577
- }
3578
- });
3579
- }
3580
- } : void 0;
3581
3554
  let response;
3582
3555
  let error;
3583
3556
  try {
3584
- response = await this.doUploadRequest(file, uploadOptions);
3557
+ response = await this.upload(attachment);
3585
3558
  } catch (err) {
3586
3559
  error = err instanceof Error ? err : void 0;
3587
3560
  }
@@ -3708,6 +3681,40 @@ var _AttachmentManager = class _AttachmentManager {
3708
3681
  ({ localMetadata }) => localMetadata.uploadState === state
3709
3682
  );
3710
3683
  }
3684
+ upload(attachment) {
3685
+ const localId = attachment.localMetadata.id;
3686
+ this.upsertAttachments([
3687
+ {
3688
+ ...attachment,
3689
+ localMetadata: {
3690
+ ...attachment.localMetadata,
3691
+ uploadState: "uploading",
3692
+ uploadProgress: this.config.trackUploadProgress ? 0 : void 0
3693
+ }
3694
+ }
3695
+ ]);
3696
+ const unsubscribe = this.client.uploadManager.state.subscribeWithSelector(
3697
+ (s) => ({ upload: s.uploads[localId] }),
3698
+ ({ upload: nextUpload }) => {
3699
+ if (!nextUpload) return;
3700
+ this.updateAttachment({
3701
+ ...attachment,
3702
+ localMetadata: {
3703
+ ...attachment.localMetadata,
3704
+ uploadState: "uploading",
3705
+ uploadProgress: nextUpload.uploadProgress
3706
+ }
3707
+ });
3708
+ }
3709
+ );
3710
+ return this.client.uploadManager.upload({
3711
+ id: localId,
3712
+ channelCid: this.channel.cid,
3713
+ file: attachment.localMetadata.file
3714
+ }).finally(() => {
3715
+ unsubscribe();
3716
+ });
3717
+ }
3711
3718
  };
3712
3719
  _AttachmentManager.toLocalUploadAttachment = (fileLike) => {
3713
3720
  const file = isFileReference(fileLike) || isFile(fileLike) ? fileLike : createFileFromBlobs({
@@ -9291,7 +9298,10 @@ var Channel = class {
9291
9298
  location: { enabled: state.channel.config.shared_locations }
9292
9299
  });
9293
9300
  }
9294
- const { messageSet } = this._initializeState(state, messageSetToAddToIfDoesNotExist);
9301
+ const { messageSet, filteredMessageIds } = this._initializeState(
9302
+ state,
9303
+ messageSetToAddToIfDoesNotExist
9304
+ );
9295
9305
  messageSet.pagination = {
9296
9306
  ...messageSet.pagination,
9297
9307
  ...messageSetPagination({
@@ -9299,6 +9309,9 @@ var Channel = class {
9299
9309
  messagePaginationOptions: options?.messages,
9300
9310
  requestedPageSize: options?.messages?.limit ?? DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE,
9301
9311
  returnedPage: state.messages,
9312
+ filteredReturnedPage: state.messages.filter(
9313
+ (m) => !filteredMessageIds.includes(m.id)
9314
+ ),
9302
9315
  logger: this.getClient().logger
9303
9316
  })
9304
9317
  };
@@ -9918,7 +9931,7 @@ var Channel = class {
9918
9931
  if (!this.state.messages) {
9919
9932
  this.state.initMessages();
9920
9933
  }
9921
- const { messageSet } = this.state.addMessagesSorted(
9934
+ const { messageSet, filteredMessageIds } = this.state.addMessagesSorted(
9922
9935
  messages,
9923
9936
  false,
9924
9937
  true,
@@ -9970,7 +9983,8 @@ var Channel = class {
9970
9983
  this.messageReceiptsTracker.ingestInitial(state.read);
9971
9984
  }
9972
9985
  return {
9973
- messageSet
9986
+ messageSet,
9987
+ filteredMessageIds
9974
9988
  };
9975
9989
  }
9976
9990
  _extendEventWithOwnReactions(event) {
@@ -10577,6 +10591,131 @@ var StableWSConnection = class {
10577
10591
  }
10578
10592
  };
10579
10593
 
10594
+ // src/uploadManager.ts
10595
+ var initState7 = () => ({ uploads: {} });
10596
+ var upsertById = (uploads, record) => ({
10597
+ ...uploads,
10598
+ [record.id]: { ...uploads[record.id], ...record }
10599
+ });
10600
+ var updateById = (uploads, record) => {
10601
+ if (!(record.id in uploads)) return null;
10602
+ const current = uploads[record.id];
10603
+ return { ...uploads, [record.id]: { ...current, ...record } };
10604
+ };
10605
+ var UploadManager = class {
10606
+ constructor(client) {
10607
+ this.client = client;
10608
+ this.inFlightUploads = /* @__PURE__ */ new Map();
10609
+ this.getUpload = (id) => this.uploads[id];
10610
+ /**
10611
+ * Clears all upload records.
10612
+ * Invoked when the user disconnects so a later session does not inherit stale upload state.
10613
+ * Aborts every in-flight upload request via its `UploadRequestOptions.abortSignal`.
10614
+ */
10615
+ this.reset = () => {
10616
+ for (const { abortController } of this.inFlightUploads.values()) {
10617
+ abortController.abort();
10618
+ }
10619
+ this.inFlightUploads.clear();
10620
+ this.state.next(initState7());
10621
+ };
10622
+ /**
10623
+ * Removes the upload record for `id` if present.
10624
+ * If an upload is still in progress, aborts its `UploadRequestOptions.abortSignal`.
10625
+ */
10626
+ this.deleteUploadRecord = (id) => {
10627
+ const flight = this.inFlightUploads.get(id);
10628
+ if (flight) {
10629
+ this.inFlightUploads.delete(id);
10630
+ flight.abortController.abort();
10631
+ }
10632
+ this.state.next((current) => {
10633
+ if (!(id in current.uploads)) return current;
10634
+ const uploads = { ...current.uploads };
10635
+ delete uploads[id];
10636
+ return { ...current, uploads };
10637
+ });
10638
+ };
10639
+ /**
10640
+ * Starts an upload for `id`, or returns the existing in-flight promise if one is already running.
10641
+ * Uses {@link StreamChat.channel}(`channelCid`) → `messageComposer.attachmentManager.doUploadRequest`.
10642
+ * Resolves with that result; rejects if the upload rejects (the record is removed from state either way).
10643
+ */
10644
+ this.upload = ({
10645
+ id,
10646
+ channelCid,
10647
+ file
10648
+ }) => {
10649
+ const existing = this.inFlightUploads.get(id);
10650
+ if (existing) return existing.promise;
10651
+ let resolvePromise;
10652
+ let rejectPromise;
10653
+ const promise = new Promise((resolve, reject) => {
10654
+ resolvePromise = resolve;
10655
+ rejectPromise = reject;
10656
+ });
10657
+ const abortController = new AbortController();
10658
+ this.inFlightUploads.set(id, { promise, abortController });
10659
+ void (async () => {
10660
+ const attachmentManager = this.resolveAttachmentManager(channelCid);
10661
+ const trackProgress = attachmentManager.config.trackUploadProgress;
10662
+ try {
10663
+ this.upsertUpload({
10664
+ id,
10665
+ uploadProgress: trackProgress ? 0 : void 0
10666
+ });
10667
+ const onProgress = trackProgress ? (progress) => {
10668
+ this.updateUpload({
10669
+ id,
10670
+ uploadProgress: progress
10671
+ });
10672
+ } : void 0;
10673
+ const uploadRequestOptions = {
10674
+ abortSignal: abortController.signal,
10675
+ ...onProgress ? { onProgress } : {}
10676
+ };
10677
+ const response = await attachmentManager.doUploadRequest(
10678
+ file,
10679
+ uploadRequestOptions
10680
+ );
10681
+ resolvePromise(response);
10682
+ } catch (error) {
10683
+ rejectPromise(error);
10684
+ } finally {
10685
+ this.inFlightUploads.delete(id);
10686
+ this.deleteUploadRecord(id);
10687
+ }
10688
+ })();
10689
+ return promise;
10690
+ };
10691
+ this.upsertUpload = (record) => {
10692
+ this.state.partialNext({
10693
+ uploads: upsertById(this.uploads, record)
10694
+ });
10695
+ };
10696
+ this.updateUpload = (record) => {
10697
+ this.state.next((current) => {
10698
+ const nextUploads = updateById(current.uploads, record);
10699
+ if (!nextUploads) return current;
10700
+ return { ...current, uploads: nextUploads };
10701
+ });
10702
+ };
10703
+ this.state = new StateStore(initState7());
10704
+ }
10705
+ resolveAttachmentManager(channelCid) {
10706
+ const colon = channelCid.indexOf(":");
10707
+ if (colon <= 0 || colon === channelCid.length - 1) {
10708
+ throw new Error(`Invalid channelCid: ${channelCid}`);
10709
+ }
10710
+ const channelType = channelCid.slice(0, colon);
10711
+ const channelId = channelCid.slice(colon + 1);
10712
+ return this.client.channel(channelType, channelId).messageComposer.attachmentManager;
10713
+ }
10714
+ get uploads() {
10715
+ return this.state.getLatestValue().uploads;
10716
+ }
10717
+ };
10718
+
10580
10719
  // src/signing.ts
10581
10720
  var import_jsonwebtoken = __toESM(require_jsonwebtoken());
10582
10721
  var import_crypto = __toESM(require_crypto());
@@ -13049,6 +13188,7 @@ var StreamChat = class _StreamChat {
13049
13188
  this.activeChannels = {};
13050
13189
  this.state = new ClientState({ client: this });
13051
13190
  this.threads.resetState();
13191
+ this.uploadManager.reset();
13052
13192
  closePromise.finally(() => {
13053
13193
  this.tokenManager.reset();
13054
13194
  }).catch((err) => console.error(err));
@@ -13455,6 +13595,7 @@ var StreamChat = class _StreamChat {
13455
13595
  this.blockedUsers = new StateStore({ userIds: [] });
13456
13596
  this.moderation = new Moderation(this);
13457
13597
  this.notifications = options?.notifications ?? new NotificationManager();
13598
+ this.uploadManager = new UploadManager(this);
13458
13599
  if (secretOrOptions && isString2(secretOrOptions)) {
13459
13600
  this.secret = secretOrOptions;
13460
13601
  }
@@ -14173,12 +14314,15 @@ var StreamChat = class _StreamChat {
14173
14314
  c.initialized = !offlineMode;
14174
14315
  c.push_preferences = channelState.push_preferences;
14175
14316
  let updatedMessagesSet;
14317
+ let filteredMessageIds = [];
14176
14318
  if (skipInitialization === void 0) {
14177
- const { messageSet } = c._initializeState(channelState, "latest");
14319
+ const { messageSet, filteredMessageIds: _filteredMessageIds } = c._initializeState(channelState, "latest");
14320
+ filteredMessageIds = _filteredMessageIds;
14178
14321
  updatedMessagesSet = messageSet;
14179
14322
  } else if (!skipInitialization.includes(channelState.channel.id)) {
14180
14323
  c.state.clearMessages();
14181
- const { messageSet } = c._initializeState(channelState, "latest");
14324
+ const { messageSet, filteredMessageIds: _filteredMessageIds } = c._initializeState(channelState, "latest");
14325
+ filteredMessageIds = _filteredMessageIds;
14182
14326
  updatedMessagesSet = messageSet;
14183
14327
  }
14184
14328
  if (updatedMessagesSet) {
@@ -14188,6 +14332,9 @@ var StreamChat = class _StreamChat {
14188
14332
  parentSet: updatedMessagesSet,
14189
14333
  requestedPageSize: queryChannelsOptions?.message_limit || DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE,
14190
14334
  returnedPage: channelState.messages,
14335
+ filteredReturnedPage: channelState.messages.filter(
14336
+ (m) => !filteredMessageIds.includes(m.id)
14337
+ ),
14191
14338
  logger: this.logger
14192
14339
  })
14193
14340
  };
@@ -15238,7 +15385,7 @@ var StreamChat = class _StreamChat {
15238
15385
  if (this.userAgent) {
15239
15386
  return this.userAgent;
15240
15387
  }
15241
- const version = "9.41.0";
15388
+ const version = "9.42.0";
15242
15389
  const clientBundle = "browser-cjs";
15243
15390
  let userAgentString = "";
15244
15391
  if (this.sdkIdentifier) {