stream-chat-react 13.4.0 → 13.5.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.
@@ -12590,7 +12590,9 @@ var ChannelPreview = (props) => {
12590
12590
  );
12591
12591
  (0, import_react23.useEffect)(() => {
12592
12592
  refreshUnreadCount();
12593
- const handleEvent = () => {
12593
+ const handleEvent = (event) => {
12594
+ const deletedMessagesInAnotherChannel = event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid;
12595
+ if (deletedMessagesInAnotherChannel) return;
12594
12596
  setLastMessage(
12595
12597
  channel.state.latestMessages[channel.state.latestMessages.length - 1]
12596
12598
  );
@@ -12599,16 +12601,18 @@ var ChannelPreview = (props) => {
12599
12601
  channel.on("message.new", handleEvent);
12600
12602
  channel.on("message.updated", handleEvent);
12601
12603
  channel.on("message.deleted", handleEvent);
12604
+ client.on("user.messages.deleted", handleEvent);
12602
12605
  channel.on("message.undeleted", handleEvent);
12603
12606
  channel.on("channel.truncated", handleEvent);
12604
12607
  return () => {
12605
12608
  channel.off("message.new", handleEvent);
12606
12609
  channel.off("message.updated", handleEvent);
12607
12610
  channel.off("message.deleted", handleEvent);
12611
+ client.off("user.messages.deleted", handleEvent);
12608
12612
  channel.off("message.undeleted", handleEvent);
12609
12613
  channel.off("channel.truncated", handleEvent);
12610
12614
  };
12611
- }, [channel, refreshUnreadCount, channelUpdateCount]);
12615
+ }, [channel, client, refreshUnreadCount, channelUpdateCount]);
12612
12616
  if (!Preview) return null;
12613
12617
  const latestMessagePreview = getLatestMessagePreview2(
12614
12618
  channel,