stream-chat-react 14.11.0 → 14.11.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.
package/dist/cjs/index.js
CHANGED
|
@@ -19810,18 +19810,27 @@ var ChannelListItem = (props) => {
|
|
|
19810
19810
|
const isActive = typeof active === "undefined" ? activeChannel?.cid === channel.cid : active;
|
|
19811
19811
|
const { muted } = require_useChannelHeaderOnlineStatus.useIsChannelMuted(channel);
|
|
19812
19812
|
(0, react.useEffect)(() => {
|
|
19813
|
-
const
|
|
19813
|
+
const handleChannelReadStateChange = (event) => {
|
|
19814
19814
|
if (channel.cid !== event.cid) return;
|
|
19815
19815
|
if (event.user?.id !== client.user?.id) return;
|
|
19816
19816
|
setUnread(channel.countUnread());
|
|
19817
19817
|
};
|
|
19818
|
-
|
|
19819
|
-
|
|
19820
|
-
|
|
19818
|
+
const handleMarkRead = (event) => {
|
|
19819
|
+
if (event.thread_id) return;
|
|
19820
|
+
if (event.user && client.user && event.user.id !== client.user.id) return;
|
|
19821
|
+
if (!event.cid) return setUnread(0);
|
|
19822
|
+
if (channel.cid !== event.cid) return;
|
|
19823
|
+
setUnread(0);
|
|
19824
|
+
};
|
|
19825
|
+
client.on("notification.mark_read", handleMarkRead);
|
|
19826
|
+
channel.on("notification.mark_unread", handleChannelReadStateChange);
|
|
19827
|
+
channel.on("message.read_locally", handleChannelReadStateChange);
|
|
19828
|
+
channel.on("message.read", handleChannelReadStateChange);
|
|
19821
19829
|
return () => {
|
|
19822
|
-
client.off("notification.mark_read",
|
|
19823
|
-
channel.off("notification.mark_unread",
|
|
19824
|
-
channel.off("message.read_locally",
|
|
19830
|
+
client.off("notification.mark_read", handleMarkRead);
|
|
19831
|
+
channel.off("notification.mark_unread", handleChannelReadStateChange);
|
|
19832
|
+
channel.off("message.read_locally", handleChannelReadStateChange);
|
|
19833
|
+
channel.off("message.read", handleChannelReadStateChange);
|
|
19825
19834
|
};
|
|
19826
19835
|
}, [channel, client]);
|
|
19827
19836
|
const refreshUnreadCount = (0, react.useMemo)(() => (0, lodash_throttle.default)(() => {
|
|
@@ -20610,7 +20619,7 @@ var useChat = ({ client, defaultLanguage = "en", i18nInstance }) => {
|
|
|
20610
20619
|
};
|
|
20611
20620
|
(0, react.useEffect)(() => {
|
|
20612
20621
|
if (!client) return;
|
|
20613
|
-
const version = "14.11.
|
|
20622
|
+
const version = "14.11.1";
|
|
20614
20623
|
const userAgent = client.getUserAgent();
|
|
20615
20624
|
if (!userAgent.includes("stream-chat-react")) client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|
|
20616
20625
|
client.threads.registerSubscriptions();
|