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
  });
@@ -17526,7 +17523,9 @@ var ChannelPreview = (props) => {
17526
17523
  );
17527
17524
  (0, import_react79.useEffect)(() => {
17528
17525
  refreshUnreadCount();
17529
- const handleEvent = () => {
17526
+ const handleEvent = (event) => {
17527
+ const deletedMessagesInAnotherChannel = event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid;
17528
+ if (deletedMessagesInAnotherChannel) return;
17530
17529
  setLastMessage(
17531
17530
  channel.state.latestMessages[channel.state.latestMessages.length - 1]
17532
17531
  );
@@ -17535,16 +17534,18 @@ var ChannelPreview = (props) => {
17535
17534
  channel.on("message.new", handleEvent);
17536
17535
  channel.on("message.updated", handleEvent);
17537
17536
  channel.on("message.deleted", handleEvent);
17537
+ client.on("user.messages.deleted", handleEvent);
17538
17538
  channel.on("message.undeleted", handleEvent);
17539
17539
  channel.on("channel.truncated", handleEvent);
17540
17540
  return () => {
17541
17541
  channel.off("message.new", handleEvent);
17542
17542
  channel.off("message.updated", handleEvent);
17543
17543
  channel.off("message.deleted", handleEvent);
17544
+ client.off("user.messages.deleted", handleEvent);
17544
17545
  channel.off("message.undeleted", handleEvent);
17545
17546
  channel.off("channel.truncated", handleEvent);
17546
17547
  };
17547
- }, [channel, refreshUnreadCount, channelUpdateCount]);
17548
+ }, [channel, client, refreshUnreadCount, channelUpdateCount]);
17548
17549
  if (!Preview) return null;
17549
17550
  const latestMessagePreview = getLatestMessagePreview2(
17550
17551
  channel,
@@ -36953,6 +36954,8 @@ var ChannelInner = (props) => {
36953
36954
  type: "updateThreadOnEvent"
36954
36955
  });
36955
36956
  }
36957
+ if (event.type === "user.messages.deleted" && event.cid && event.cid !== channel.cid)
36958
+ return;
36956
36959
  if (event.type === "user.watching.start" || event.type === "user.watching.stop")
36957
36960
  return;
36958
36961
  if (event.type === "typing.start" || event.type === "typing.stop") {
@@ -37050,6 +37053,7 @@ var ChannelInner = (props) => {
37050
37053
  client.on("connection.recovered", handleEvent);
37051
37054
  client.on("user.updated", handleEvent);
37052
37055
  client.on("user.deleted", handleEvent);
37056
+ client.on("user.messages.deleted", handleEvent);
37053
37057
  channel.on(handleEvent);
37054
37058
  }
37055
37059
  })();
@@ -37759,7 +37763,7 @@ var useChat = ({
37759
37763
  };
37760
37764
  (0, import_react279.useEffect)(() => {
37761
37765
  if (!client) return;
37762
- const version = "13.4.0";
37766
+ const version = "13.5.1";
37763
37767
  const userAgent = client.getUserAgent();
37764
37768
  if (!userAgent.includes("stream-chat-react")) {
37765
37769
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);