stream-chat-react 13.4.0 → 13.5.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.
@@ -3971,9 +3971,6 @@ var useChannelListShapeDefaults = () => {
3971
3971
  lastPinnedChannelIndex = findLastPinnedChannelIndex({ channels: newChannels });
3972
3972
  }
3973
3973
  const newTargetChannelIndex = typeof lastPinnedChannelIndex === "number" ? lastPinnedChannelIndex + 1 : 0;
3974
- if (currentChannels[newTargetChannelIndex] === targetChannel) {
3975
- return currentChannels;
3976
- }
3977
3974
  newChannels.splice(newTargetChannelIndex, 0, targetChannel);
3978
3975
  return newChannels;
3979
3976
  });
@@ -15656,7 +15653,9 @@ var ChannelPreview = (props) => {
15656
15653
  );
15657
15654
  (0, import_react79.useEffect)(() => {
15658
15655
  refreshUnreadCount();
15659
- const handleEvent = () => {
15656
+ const handleEvent = (event) => {
15657
+ const deletedMessagesInAnotherChannel = event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid;
15658
+ if (deletedMessagesInAnotherChannel) return;
15660
15659
  setLastMessage(
15661
15660
  channel.state.latestMessages[channel.state.latestMessages.length - 1]
15662
15661
  );
@@ -15665,16 +15664,18 @@ var ChannelPreview = (props) => {
15665
15664
  channel.on("message.new", handleEvent);
15666
15665
  channel.on("message.updated", handleEvent);
15667
15666
  channel.on("message.deleted", handleEvent);
15667
+ client.on("user.messages.deleted", handleEvent);
15668
15668
  channel.on("message.undeleted", handleEvent);
15669
15669
  channel.on("channel.truncated", handleEvent);
15670
15670
  return () => {
15671
15671
  channel.off("message.new", handleEvent);
15672
15672
  channel.off("message.updated", handleEvent);
15673
15673
  channel.off("message.deleted", handleEvent);
15674
+ client.off("user.messages.deleted", handleEvent);
15674
15675
  channel.off("message.undeleted", handleEvent);
15675
15676
  channel.off("channel.truncated", handleEvent);
15676
15677
  };
15677
- }, [channel, refreshUnreadCount, channelUpdateCount]);
15678
+ }, [channel, client, refreshUnreadCount, channelUpdateCount]);
15678
15679
  if (!Preview) return null;
15679
15680
  const latestMessagePreview = getLatestMessagePreview2(
15680
15681
  channel,
@@ -35083,6 +35084,8 @@ var ChannelInner = (props) => {
35083
35084
  type: "updateThreadOnEvent"
35084
35085
  });
35085
35086
  }
35087
+ if (event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid)
35088
+ return;
35086
35089
  if (event.type === "user.watching.start" || event.type === "user.watching.stop")
35087
35090
  return;
35088
35091
  if (event.type === "typing.start" || event.type === "typing.stop") {
@@ -35180,6 +35183,7 @@ var ChannelInner = (props) => {
35180
35183
  client.on("connection.recovered", handleEvent);
35181
35184
  client.on("user.updated", handleEvent);
35182
35185
  client.on("user.deleted", handleEvent);
35186
+ client.on("user.messages.deleted", handleEvent);
35183
35187
  channel.on(handleEvent);
35184
35188
  }
35185
35189
  })();
@@ -35889,7 +35893,7 @@ var useChat = ({
35889
35893
  };
35890
35894
  (0, import_react279.useEffect)(() => {
35891
35895
  if (!client) return;
35892
- const version = "13.4.0";
35896
+ const version = "13.5.1";
35893
35897
  const userAgent = client.getUserAgent();
35894
35898
  if (!userAgent.includes("stream-chat-react")) {
35895
35899
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);