stream-chat-react 12.1.0 → 12.2.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.
Files changed (22) hide show
  1. package/dist/components/ChannelList/ChannelList.js +3 -1
  2. package/dist/components/ChannelList/hooks/useChannelDeletedListener.js +2 -3
  3. package/dist/components/ChannelList/hooks/useChannelHiddenListener.js +1 -2
  4. package/dist/components/ChannelList/hooks/useChannelTruncatedListener.js +1 -2
  5. package/dist/components/ChannelList/hooks/useChannelUpdatedListener.js +1 -2
  6. package/dist/components/ChannelList/hooks/useChannelVisibleListener.js +1 -2
  7. package/dist/components/ChannelList/hooks/useConnectionRecoveredListener.js +1 -2
  8. package/dist/components/ChannelList/hooks/useMessageNewListener.js +7 -2
  9. package/dist/components/ChannelList/hooks/useNotificationAddedToChannelListener.js +1 -2
  10. package/dist/components/ChannelList/hooks/useNotificationMessageNewListener.js +1 -2
  11. package/dist/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.js +1 -2
  12. package/dist/components/ChannelList/hooks/useUserPresenceChangedListener.js +1 -2
  13. package/dist/components/MessageList/VirtualizedMessageList.d.ts +2 -2
  14. package/dist/components/MessageList/VirtualizedMessageList.js +2 -1
  15. package/dist/components/MessageList/VirtualizedMessageListComponents.js +2 -2
  16. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.d.ts +0 -1
  17. package/dist/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.js +21 -17
  18. package/dist/index.browser.cjs +58 -46
  19. package/dist/index.browser.cjs.map +3 -3
  20. package/dist/index.node.cjs +82 -70
  21. package/dist/index.node.cjs.map +3 -3
  22. package/package.json +1 -1
@@ -66,7 +66,9 @@ const UnMemoizedChannelList = (props) => {
66
66
  * For some events, inner properties on the channel will update but the shallow comparison will not
67
67
  * force a re-render. Incrementing this dummy variable ensures the channel previews update.
68
68
  */
69
- const forceUpdate = () => setChannelUpdateCount((count) => count + 1);
69
+ const forceUpdate = useCallback(() => setChannelUpdateCount((count) => count + 1), [
70
+ setChannelUpdateCount,
71
+ ]);
70
72
  const onSearch = useCallback((event) => {
71
73
  if (!event.target.value) {
72
74
  setSearchActive(false);
@@ -12,7 +12,7 @@ export const useChannelDeletedListener = (setChannels, customHandler) => {
12
12
  const channelIndex = channels.findIndex((channel) => channel.cid === event.cid);
13
13
  if (channelIndex < 0)
14
14
  return [...channels];
15
- // Remove the deleted channel from the list.s
15
+ // Remove the deleted channel from the list
16
16
  channels.splice(channelIndex, 1);
17
17
  return [...channels];
18
18
  });
@@ -22,6 +22,5 @@ export const useChannelDeletedListener = (setChannels, customHandler) => {
22
22
  return () => {
23
23
  client.off('channel.deleted', handleEvent);
24
24
  };
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [customHandler]);
25
+ }, [client, customHandler, setChannels]);
27
26
  };
@@ -22,6 +22,5 @@ export const useChannelHiddenListener = (setChannels, customHandler) => {
22
22
  return () => {
23
23
  client.off('channel.hidden', handleEvent);
24
24
  };
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [customHandler]);
25
+ }, [client, customHandler, setChannels]);
27
26
  };
@@ -16,6 +16,5 @@ export const useChannelTruncatedListener = (setChannels, customHandler, forceUpd
16
16
  return () => {
17
17
  client.off('channel.truncated', handleEvent);
18
18
  };
19
- // eslint-disable-next-line react-hooks/exhaustive-deps
20
- }, [customHandler]);
19
+ }, [client, customHandler, forceUpdate, setChannels]);
21
20
  };
@@ -28,6 +28,5 @@ export const useChannelUpdatedListener = (setChannels, customHandler, forceUpdat
28
28
  return () => {
29
29
  client.off('channel.updated', handleEvent);
30
30
  };
31
- // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [customHandler]);
31
+ }, [client, customHandler, forceUpdate, setChannels]);
33
32
  };
@@ -22,6 +22,5 @@ export const useChannelVisibleListener = (setChannels, customHandler) => {
22
22
  return () => {
23
23
  client.off('channel.visible', handleEvent);
24
24
  };
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [customHandler]);
25
+ }, [client, customHandler, setChannels]);
27
26
  };
@@ -12,6 +12,5 @@ export const useConnectionRecoveredListener = (forceUpdate) => {
12
12
  return () => {
13
13
  client.off('connection.recovered', handleEvent);
14
14
  };
15
- // eslint-disable-next-line react-hooks/exhaustive-deps
16
- }, []);
15
+ }, [client, forceUpdate]);
17
16
  };
@@ -26,6 +26,11 @@ export const useMessageNewListener = (setChannels, customHandler, lockChannelOrd
26
26
  return () => {
27
27
  client.off('message.new', handleEvent);
28
28
  };
29
- // eslint-disable-next-line react-hooks/exhaustive-deps
30
- }, [lockChannelOrder]);
29
+ }, [
30
+ allowNewMessagesFromUnfilteredChannels,
31
+ client,
32
+ customHandler,
33
+ lockChannelOrder,
34
+ setChannels,
35
+ ]);
31
36
  };
@@ -29,6 +29,5 @@ export const useNotificationAddedToChannelListener = (setChannels, customHandler
29
29
  return () => {
30
30
  client.off('notification.added_to_channel', handleEvent);
31
31
  };
32
- // eslint-disable-next-line react-hooks/exhaustive-deps
33
- }, [customHandler]);
32
+ }, [allowNewMessagesFromUnfilteredChannels, client, customHandler, setChannels]);
34
33
  };
@@ -22,6 +22,5 @@ export const useNotificationMessageNewListener = (setChannels, customHandler, al
22
22
  return () => {
23
23
  client.off('notification.message_new', handleEvent);
24
24
  };
25
- // eslint-disable-next-line react-hooks/exhaustive-deps
26
- }, [customHandler]);
25
+ }, [allowNewMessagesFromUnfilteredChannels, client, customHandler, setChannels]);
27
26
  };
@@ -15,6 +15,5 @@ export const useNotificationRemovedFromChannelListener = (setChannels, customHan
15
15
  return () => {
16
16
  client.off('notification.removed_from_channel', handleEvent);
17
17
  };
18
- // eslint-disable-next-line react-hooks/exhaustive-deps
19
- }, [customHandler]);
18
+ }, [client, customHandler, setChannels]);
20
19
  };
@@ -20,6 +20,5 @@ export const useUserPresenceChangedListener = (setChannels) => {
20
20
  return () => {
21
21
  client.off('user.presence.changed', handleEvent);
22
22
  };
23
- // eslint-disable-next-line react-hooks/exhaustive-deps
24
- }, []);
23
+ }, [client, setChannels]);
25
24
  };
@@ -8,7 +8,8 @@ import { ChatContextValue } from '../../context/ChatContext';
8
8
  import { ComponentContextValue } from '../../context/ComponentContext';
9
9
  import type { UserResponse } from 'stream-chat';
10
10
  import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
11
- type VirtualizedMessageListPropsForContext = 'additionalMessageInputProps' | 'closeReactionSelectorOnClick' | 'customMessageActions' | 'customMessageRenderer' | 'formatDate' | 'head' | 'loadingMore' | 'Message' | 'messageActions' | 'shouldGroupByUser' | 'reactionDetailsSort' | 'sortReactions' | 'sortReactionDetails' | 'threadList';
11
+ type PropsDrilledToMessage = 'additionalMessageInputProps' | 'customMessageActions' | 'formatDate' | 'messageActions' | 'openThread' | 'reactionDetailsSort' | 'sortReactions' | 'sortReactionDetails';
12
+ type VirtualizedMessageListPropsForContext = PropsDrilledToMessage | 'closeReactionSelectorOnClick' | 'customMessageRenderer' | 'head' | 'loadingMore' | 'Message' | 'shouldGroupByUser' | 'threadList';
12
13
  /**
13
14
  * Context object provided to some Virtuoso props that are functions (components rendered by Virtuoso and other functions)
14
15
  */
@@ -36,7 +37,6 @@ export type VirtuosoContext<StreamChatGenerics extends DefaultStreamChatGenerics
36
37
  /** The number of unread messages in the current channel. */
37
38
  unreadMessageCount?: number;
38
39
  };
39
- type PropsDrilledToMessage = 'additionalMessageInputProps' | 'customMessageActions' | 'formatDate' | 'messageActions' | 'reactionDetailsSort' | 'sortReactions' | 'sortReactionDetails';
40
40
  export type VirtualizedMessageListProps<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Partial<Pick<MessageProps<StreamChatGenerics>, PropsDrilledToMessage>> & {
41
41
  /** Additional props to be passed the underlying [`react-virtuoso` virtualized list dependency](https://virtuoso.dev/virtuoso-api-reference/) */
42
42
  additionalVirtuosoProps?: VirtuosoProps<UnknownType, VirtuosoContext<StreamChatGenerics>>;
@@ -50,7 +50,7 @@ function calculateInitialTopMostItemIndex(messages, highlightedMessageId) {
50
50
  return messages.length - 1;
51
51
  }
52
52
  const VirtualizedMessageListWithContext = (props) => {
53
- const { additionalMessageInputProps, additionalVirtuosoProps = {}, channel, channelUnreadUiState, closeReactionSelectorOnClick, customMessageActions, customMessageRenderer, defaultItemHeight, disableDateSeparator = true, formatDate, groupStyles, hasMoreNewer, head, hideDeletedMessages = false, hideNewMessageSeparator = false, highlightedMessageId, jumpToLatestMessage, loadingMore, loadMore, loadMoreNewer, maxTimeBetweenGroupedMessages, Message: MessageUIComponentFromProps, messageActions, messageLimit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE, messages, notifications,
53
+ const { additionalMessageInputProps, additionalVirtuosoProps = {}, channel, channelUnreadUiState, closeReactionSelectorOnClick, customMessageActions, customMessageRenderer, defaultItemHeight, disableDateSeparator = true, formatDate, groupStyles, hasMoreNewer, head, hideDeletedMessages = false, hideNewMessageSeparator = false, highlightedMessageId, jumpToLatestMessage, loadingMore, loadMore, loadMoreNewer, maxTimeBetweenGroupedMessages, Message: MessageUIComponentFromProps, messageActions, messageLimit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE, messages, notifications, openThread,
54
54
  // TODO: refactor to scrollSeekPlaceHolderConfiguration and components.ScrollSeekPlaceholder, like the Virtuoso Component
55
55
  overscan = 0, read, returnAllReadData = false, reviewProcessedMessage, scrollSeekPlaceHolder, scrollToLatestMessageOnFocus = false, separateGiphyPreview = false, shouldGroupByUser = false, showUnreadNotificationAlways, reactionDetailsSort, sortReactionDetails, sortReactions, stickToBottomScrollBehavior = 'smooth', suppressAutoscroll, threadList, } = props;
56
56
  const { components: virtuosoComponentsFromProps, ...overridingVirtuosoProps } = additionalVirtuosoProps;
@@ -218,6 +218,7 @@ const VirtualizedMessageListWithContext = (props) => {
218
218
  messageGroupStyles,
219
219
  MessageSystem,
220
220
  numItemsPrepended,
221
+ openThread,
221
222
  ownMessagesReadByOthers,
222
223
  processedMessages,
223
224
  reactionDetailsSort,
@@ -47,7 +47,7 @@ export const EmptyPlaceholder = ({ context, }) => {
47
47
  return (React.createElement(React.Fragment, null, EmptyStateIndicator && (React.createElement(EmptyStateIndicator, { listType: context?.threadList ? 'thread' : 'message' }))));
48
48
  };
49
49
  export const messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
50
- const { additionalMessageInputProps, closeReactionSelectorOnClick, customMessageActions, customMessageRenderer, DateSeparator, firstUnreadMessageId, formatDate, lastReadDate, lastReadMessageId, lastReceivedMessageId, Message: MessageUIComponent, messageActions, messageGroupStyles, MessageSystem, numItemsPrepended, ownMessagesReadByOthers, processedMessages: messageList, reactionDetailsSort, shouldGroupByUser, sortReactionDetails, sortReactions, threadList, unreadMessageCount = 0, UnreadMessagesSeparator, virtuosoRef, } = virtuosoContext;
50
+ const { additionalMessageInputProps, closeReactionSelectorOnClick, customMessageActions, customMessageRenderer, DateSeparator, firstUnreadMessageId, formatDate, lastReadDate, lastReadMessageId, lastReceivedMessageId, Message: MessageUIComponent, messageActions, messageGroupStyles, MessageSystem, numItemsPrepended, openThread, ownMessagesReadByOthers, processedMessages: messageList, reactionDetailsSort, shouldGroupByUser, sortReactionDetails, sortReactions, threadList, unreadMessageCount = 0, UnreadMessagesSeparator, virtuosoRef, } = virtuosoContext;
51
51
  const streamMessageIndex = calculateItemIndex(virtuosoIndex, numItemsPrepended);
52
52
  if (customMessageRenderer) {
53
53
  return customMessageRenderer(messageList, streamMessageIndex);
@@ -89,7 +89,7 @@ export const messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
89
89
  return (React.createElement(React.Fragment, null,
90
90
  showUnreadSeparatorAbove && (React.createElement("div", { className: 'str-chat__unread-messages-separator-wrapper' },
91
91
  React.createElement(UnreadMessagesSeparator, { unreadCount: unreadMessageCount }))),
92
- React.createElement(Message, { additionalMessageInputProps: additionalMessageInputProps, autoscrollToBottom: virtuosoRef.current?.autoscrollToBottom, closeReactionSelectorOnClick: closeReactionSelectorOnClick, customMessageActions: customMessageActions, endOfGroup: endOfGroup, firstOfGroup: firstOfGroup, formatDate: formatDate, groupedByUser: groupedByUser, groupStyles: [messageGroupStyles[message.id] ?? ''], lastReceivedId: lastReceivedMessageId, message: message, Message: MessageUIComponent, messageActions: messageActions, reactionDetailsSort: reactionDetailsSort, readBy: ownMessagesReadByOthers[message.id] || [], sortReactionDetails: sortReactionDetails, sortReactions: sortReactions, threadList: threadList }),
92
+ React.createElement(Message, { additionalMessageInputProps: additionalMessageInputProps, autoscrollToBottom: virtuosoRef.current?.autoscrollToBottom, closeReactionSelectorOnClick: closeReactionSelectorOnClick, customMessageActions: customMessageActions, endOfGroup: endOfGroup, firstOfGroup: firstOfGroup, formatDate: formatDate, groupedByUser: groupedByUser, groupStyles: [messageGroupStyles[message.id] ?? ''], lastReceivedId: lastReceivedMessageId, message: message, Message: MessageUIComponent, messageActions: messageActions, openThread: openThread, reactionDetailsSort: reactionDetailsSort, readBy: ownMessagesReadByOthers[message.id] || [], sortReactionDetails: sortReactionDetails, sortReactions: sortReactions, threadList: threadList }),
93
93
  showUnreadSeparatorBelow && (React.createElement("div", { className: 'str-chat__unread-messages-separator-wrapper' },
94
94
  React.createElement(UnreadMessagesSeparator, { unreadCount: unreadMessageCount })))));
95
95
  };
@@ -1,7 +1,6 @@
1
1
  import { StreamMessage } from '../../../../context';
2
2
  import { DefaultStreamChatGenerics } from '../../../../types/types';
3
3
  type UseScrollToBottomOnNewMessageParams<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = {
4
- /** */
5
4
  scrollToBottom: () => void;
6
5
  messages?: StreamMessage<StreamChatGenerics>[];
7
6
  /** When `true`, the list will scroll to the latest message when the window regains focus */
@@ -1,28 +1,32 @@
1
- import React, { useCallback, useEffect } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
  export const useScrollToBottomOnNewMessage = ({ messages, scrollToBottom, scrollToLatestMessageOnFocus, }) => {
3
- const [newMessagesReceivedInBackground, setNewMessagesReceivedInBackground] = React.useState(false);
4
- const resetNewMessagesReceivedInBackground = useCallback(() => {
5
- setNewMessagesReceivedInBackground(false);
6
- }, []);
7
- useEffect(() => {
8
- setNewMessagesReceivedInBackground(true);
9
- }, [messages]);
10
- const scrollToBottomIfConfigured = useCallback((event) => {
3
+ const [newMessagesReceivedInBackground, setNewMessagesReceivedInBackground] = useState(false);
4
+ const scrollToBottomIfConfigured = useRef();
5
+ scrollToBottomIfConfigured.current = (event) => {
11
6
  if (!scrollToLatestMessageOnFocus ||
12
7
  !newMessagesReceivedInBackground ||
13
- event.target !== window)
8
+ event.target !== window) {
14
9
  return;
10
+ }
15
11
  setTimeout(scrollToBottom, 100);
16
- }, [scrollToLatestMessageOnFocus, scrollToBottom, newMessagesReceivedInBackground]);
12
+ };
17
13
  useEffect(() => {
14
+ setNewMessagesReceivedInBackground(true);
15
+ }, [messages]);
16
+ useEffect(() => {
17
+ const handleFocus = (event) => {
18
+ scrollToBottomIfConfigured.current?.(event);
19
+ };
20
+ const handleBlur = () => {
21
+ setNewMessagesReceivedInBackground(false);
22
+ };
18
23
  if (typeof window !== 'undefined') {
19
- window.addEventListener('focus', scrollToBottomIfConfigured);
20
- window.addEventListener('blur', resetNewMessagesReceivedInBackground);
24
+ window.addEventListener('focus', handleFocus);
25
+ window.addEventListener('blur', handleBlur);
21
26
  }
22
27
  return () => {
23
- window.removeEventListener('focus', scrollToBottomIfConfigured);
24
- window.removeEventListener('blur', resetNewMessagesReceivedInBackground);
28
+ window.removeEventListener('focus', handleFocus);
29
+ window.removeEventListener('blur', handleBlur);
25
30
  };
26
- // eslint-disable-next-line react-hooks/exhaustive-deps
27
- }, [scrollToBottomIfConfigured]);
31
+ }, []);
28
32
  };
@@ -8278,7 +8278,7 @@ var require_disallow_node = __commonJS({
8278
8278
  var require_ast_to_react = __commonJS({
8279
8279
  "node_modules/mml-react/node_modules/react-markdown/lib/ast-to-react.js"(exports, module2) {
8280
8280
  "use strict";
8281
- var React172 = require("react");
8281
+ var React171 = require("react");
8282
8282
  var xtend = require_immutable();
8283
8283
  var ReactIs2 = require("react-is");
8284
8284
  function astToReact(node2, options) {
@@ -8305,7 +8305,7 @@ var require_ast_to_react = __commonJS({
8305
8305
  throw new Error("Renderer for type `".concat(node2.type, "` not defined or is not renderable"));
8306
8306
  }
8307
8307
  var nodeProps = getNodeProps(node2, key, options, renderer, parent, index3);
8308
- return React172.createElement(renderer, nodeProps, nodeProps.children || resolveChildren() || void 0);
8308
+ return React171.createElement(renderer, nodeProps, nodeProps.children || resolveChildren() || void 0);
8309
8309
  function resolveChildren() {
8310
8310
  return node2.children && node2.children.map(function(childNode, i) {
8311
8311
  return astToReact(childNode, options, {
@@ -8319,7 +8319,7 @@ var require_ast_to_react = __commonJS({
8319
8319
  var props = {
8320
8320
  key
8321
8321
  };
8322
- var isSimpleRenderer = typeof renderer === "string" || renderer === React172.Fragment;
8322
+ var isSimpleRenderer = typeof renderer === "string" || renderer === React171.Fragment;
8323
8323
  if (opts.sourcePos && node2.position) {
8324
8324
  props["data-sourcepos"] = flattenPosition2(node2.position);
8325
8325
  }
@@ -8472,14 +8472,14 @@ var require_ast_to_react = __commonJS({
8472
8472
  function mergeNodeChildren(node2, parsedChildren) {
8473
8473
  var el = node2.element;
8474
8474
  if (Array.isArray(el)) {
8475
- var Fragment2 = React172.Fragment || "div";
8476
- return React172.createElement(Fragment2, null, el);
8475
+ var Fragment2 = React171.Fragment || "div";
8476
+ return React171.createElement(Fragment2, null, el);
8477
8477
  }
8478
8478
  if (el.props.children || parsedChildren) {
8479
- var children = React172.Children.toArray(el.props.children).concat(parsedChildren);
8480
- return React172.cloneElement(el, null, children);
8479
+ var children = React171.Children.toArray(el.props.children).concat(parsedChildren);
8480
+ return React171.cloneElement(el, null, children);
8481
8481
  }
8482
- return React172.cloneElement(el, null);
8482
+ return React171.cloneElement(el, null);
8483
8483
  }
8484
8484
  function flattenPosition2(pos) {
8485
8485
  return [pos.start.line, ":", pos.start.column, "-", pos.end.line, ":", pos.end.column].map(String).join("");
@@ -8603,9 +8603,9 @@ var require_renderers = __commonJS({
8603
8603
  "node_modules/mml-react/node_modules/react-markdown/lib/renderers.js"(exports, module2) {
8604
8604
  "use strict";
8605
8605
  var xtend = require_immutable();
8606
- var React172 = require("react");
8607
- var supportsStringRender = parseInt((React172.version || "16").slice(0, 2), 10) >= 16;
8608
- var createElement = React172.createElement;
8606
+ var React171 = require("react");
8607
+ var supportsStringRender = parseInt((React171.version || "16").slice(0, 2), 10) >= 16;
8608
+ var createElement = React171.createElement;
8609
8609
  module2.exports = {
8610
8610
  break: "br",
8611
8611
  paragraph: "p",
@@ -8641,7 +8641,7 @@ var require_renderers = __commonJS({
8641
8641
  }
8642
8642
  function Root(props) {
8643
8643
  var className = props.className;
8644
- var root2 = !className && React172.Fragment || "div";
8644
+ var root2 = !className && React171.Fragment || "div";
8645
8645
  return createElement(root2, className ? {
8646
8646
  className
8647
8647
  } : null, props.children);
@@ -8697,7 +8697,7 @@ var require_renderers = __commonJS({
8697
8697
  var dangerous = props.allowDangerousHtml || props.escapeHtml === false;
8698
8698
  var tag = props.isBlock ? "div" : "span";
8699
8699
  if (!dangerous) {
8700
- return createElement(React172.Fragment || tag, null, props.value);
8700
+ return createElement(React171.Fragment || tag, null, props.value);
8701
8701
  }
8702
8702
  var nodeProps = {
8703
8703
  dangerouslySetInnerHTML: {
@@ -8707,7 +8707,7 @@ var require_renderers = __commonJS({
8707
8707
  return createElement(tag, nodeProps);
8708
8708
  }
8709
8709
  function ParsedHtml(props) {
8710
- return props["data-sourcepos"] ? React172.cloneElement(props.element, {
8710
+ return props["data-sourcepos"] ? React171.cloneElement(props.element, {
8711
8711
  "data-sourcepos": props["data-sourcepos"]
8712
8712
  }) : props.element;
8713
8713
  }
@@ -44536,39 +44536,39 @@ var useMessageSetKey = ({
44536
44536
  };
44537
44537
 
44538
44538
  // src/components/MessageList/hooks/VirtualizedMessageList/useScrollToBottomOnNewMessage.ts
44539
- var import_react183 = __toESM(require("react"));
44539
+ var import_react183 = require("react");
44540
44540
  var useScrollToBottomOnNewMessage = ({
44541
44541
  messages,
44542
44542
  scrollToBottom,
44543
44543
  scrollToLatestMessageOnFocus
44544
44544
  }) => {
44545
- const [newMessagesReceivedInBackground, setNewMessagesReceivedInBackground] = import_react183.default.useState(
44546
- false
44547
- );
44548
- const resetNewMessagesReceivedInBackground = (0, import_react183.useCallback)(() => {
44549
- setNewMessagesReceivedInBackground(false);
44550
- }, []);
44545
+ const [newMessagesReceivedInBackground, setNewMessagesReceivedInBackground] = (0, import_react183.useState)(false);
44546
+ const scrollToBottomIfConfigured = (0, import_react183.useRef)();
44547
+ scrollToBottomIfConfigured.current = (event) => {
44548
+ if (!scrollToLatestMessageOnFocus || !newMessagesReceivedInBackground || event.target !== window) {
44549
+ return;
44550
+ }
44551
+ setTimeout(scrollToBottom, 100);
44552
+ };
44551
44553
  (0, import_react183.useEffect)(() => {
44552
44554
  setNewMessagesReceivedInBackground(true);
44553
44555
  }, [messages]);
44554
- const scrollToBottomIfConfigured = (0, import_react183.useCallback)(
44555
- (event) => {
44556
- if (!scrollToLatestMessageOnFocus || !newMessagesReceivedInBackground || event.target !== window)
44557
- return;
44558
- setTimeout(scrollToBottom, 100);
44559
- },
44560
- [scrollToLatestMessageOnFocus, scrollToBottom, newMessagesReceivedInBackground]
44561
- );
44562
44556
  (0, import_react183.useEffect)(() => {
44557
+ const handleFocus = (event) => {
44558
+ scrollToBottomIfConfigured.current?.(event);
44559
+ };
44560
+ const handleBlur = () => {
44561
+ setNewMessagesReceivedInBackground(false);
44562
+ };
44563
44563
  if (typeof window !== "undefined") {
44564
- window.addEventListener("focus", scrollToBottomIfConfigured);
44565
- window.addEventListener("blur", resetNewMessagesReceivedInBackground);
44564
+ window.addEventListener("focus", handleFocus);
44565
+ window.addEventListener("blur", handleBlur);
44566
44566
  }
44567
44567
  return () => {
44568
- window.removeEventListener("focus", scrollToBottomIfConfigured);
44569
- window.removeEventListener("blur", resetNewMessagesReceivedInBackground);
44568
+ window.removeEventListener("focus", handleFocus);
44569
+ window.removeEventListener("blur", handleBlur);
44570
44570
  };
44571
- }, [scrollToBottomIfConfigured]);
44571
+ }, []);
44572
44572
  };
44573
44573
 
44574
44574
  // src/components/MessageList/hooks/VirtualizedMessageList/useUnreadMessagesNotificationVirtualized.ts
@@ -44669,6 +44669,7 @@ var messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
44669
44669
  messageGroupStyles,
44670
44670
  MessageSystem,
44671
44671
  numItemsPrepended,
44672
+ openThread,
44672
44673
  ownMessagesReadByOthers,
44673
44674
  processedMessages: messageList,
44674
44675
  reactionDetailsSort,
@@ -44721,6 +44722,7 @@ var messageRenderer = (virtuosoIndex, _data, virtuosoContext) => {
44721
44722
  message,
44722
44723
  Message: MessageUIComponent,
44723
44724
  messageActions,
44725
+ openThread,
44724
44726
  reactionDetailsSort,
44725
44727
  readBy: ownMessagesReadByOthers[message.id] || [],
44726
44728
  sortReactionDetails,
@@ -44787,6 +44789,7 @@ var VirtualizedMessageListWithContext = (props) => {
44787
44789
  messageLimit = DEFAULT_NEXT_CHANNEL_PAGE_SIZE,
44788
44790
  messages,
44789
44791
  notifications,
44792
+ openThread,
44790
44793
  // TODO: refactor to scrollSeekPlaceHolderConfiguration and components.ScrollSeekPlaceholder, like the Virtuoso Component
44791
44794
  overscan = 0,
44792
44795
  read,
@@ -45002,6 +45005,7 @@ var VirtualizedMessageListWithContext = (props) => {
45002
45005
  messageGroupStyles,
45003
45006
  MessageSystem,
45004
45007
  numItemsPrepended,
45008
+ openThread,
45005
45009
  ownMessagesReadByOthers,
45006
45010
  processedMessages,
45007
45011
  reactionDetailsSort,
@@ -46192,7 +46196,7 @@ var useChannelDeletedListener = (setChannels, customHandler) => {
46192
46196
  return () => {
46193
46197
  client.off("channel.deleted", handleEvent);
46194
46198
  };
46195
- }, [customHandler]);
46199
+ }, [client, customHandler, setChannels]);
46196
46200
  };
46197
46201
 
46198
46202
  // src/components/ChannelList/hooks/useChannelHiddenListener.ts
@@ -46216,7 +46220,7 @@ var useChannelHiddenListener = (setChannels, customHandler) => {
46216
46220
  return () => {
46217
46221
  client.off("channel.hidden", handleEvent);
46218
46222
  };
46219
- }, [customHandler]);
46223
+ }, [client, customHandler, setChannels]);
46220
46224
  };
46221
46225
 
46222
46226
  // src/components/ChannelList/hooks/useChannelTruncatedListener.ts
@@ -46237,7 +46241,7 @@ var useChannelTruncatedListener = (setChannels, customHandler, forceUpdate) => {
46237
46241
  return () => {
46238
46242
  client.off("channel.truncated", handleEvent);
46239
46243
  };
46240
- }, [customHandler]);
46244
+ }, [client, customHandler, forceUpdate, setChannels]);
46241
46245
  };
46242
46246
 
46243
46247
  // src/components/ChannelList/hooks/useChannelUpdatedListener.ts
@@ -46270,7 +46274,7 @@ var useChannelUpdatedListener = (setChannels, customHandler, forceUpdate) => {
46270
46274
  return () => {
46271
46275
  client.off("channel.updated", handleEvent);
46272
46276
  };
46273
- }, [customHandler]);
46277
+ }, [client, customHandler, forceUpdate, setChannels]);
46274
46278
  };
46275
46279
 
46276
46280
  // src/components/ChannelList/hooks/useChannelVisibleListener.ts
@@ -46295,7 +46299,7 @@ var useChannelVisibleListener = (setChannels, customHandler) => {
46295
46299
  return () => {
46296
46300
  client.off("channel.visible", handleEvent);
46297
46301
  };
46298
- }, [customHandler]);
46302
+ }, [client, customHandler, setChannels]);
46299
46303
  };
46300
46304
 
46301
46305
  // src/components/ChannelList/hooks/useConnectionRecoveredListener.ts
@@ -46312,7 +46316,7 @@ var useConnectionRecoveredListener = (forceUpdate) => {
46312
46316
  return () => {
46313
46317
  client.off("connection.recovered", handleEvent);
46314
46318
  };
46315
- }, []);
46319
+ }, [client, forceUpdate]);
46316
46320
  };
46317
46321
 
46318
46322
  // src/components/ChannelList/hooks/useMessageNewListener.ts
@@ -46356,7 +46360,13 @@ var useMessageNewListener = (setChannels, customHandler, lockChannelOrder = fals
46356
46360
  return () => {
46357
46361
  client.off("message.new", handleEvent);
46358
46362
  };
46359
- }, [lockChannelOrder]);
46363
+ }, [
46364
+ allowNewMessagesFromUnfilteredChannels,
46365
+ client,
46366
+ customHandler,
46367
+ lockChannelOrder,
46368
+ setChannels
46369
+ ]);
46360
46370
  };
46361
46371
 
46362
46372
  // src/components/ChannelList/hooks/useMobileNavigation.ts
@@ -46404,7 +46414,7 @@ var useNotificationAddedToChannelListener = (setChannels, customHandler, allowNe
46404
46414
  return () => {
46405
46415
  client.off("notification.added_to_channel", handleEvent);
46406
46416
  };
46407
- }, [customHandler]);
46417
+ }, [allowNewMessagesFromUnfilteredChannels, client, customHandler, setChannels]);
46408
46418
  };
46409
46419
 
46410
46420
  // src/components/ChannelList/hooks/useNotificationMessageNewListener.ts
@@ -46429,7 +46439,7 @@ var useNotificationMessageNewListener = (setChannels, customHandler, allowNewMes
46429
46439
  return () => {
46430
46440
  client.off("notification.message_new", handleEvent);
46431
46441
  };
46432
- }, [customHandler]);
46442
+ }, [allowNewMessagesFromUnfilteredChannels, client, customHandler, setChannels]);
46433
46443
  };
46434
46444
 
46435
46445
  // src/components/ChannelList/hooks/useNotificationRemovedFromChannelListener.ts
@@ -46450,7 +46460,7 @@ var useNotificationRemovedFromChannelListener = (setChannels, customHandler) =>
46450
46460
  return () => {
46451
46461
  client.off("notification.removed_from_channel", handleEvent);
46452
46462
  };
46453
- }, [customHandler]);
46463
+ }, [client, customHandler, setChannels]);
46454
46464
  };
46455
46465
 
46456
46466
  // src/components/ChannelList/hooks/usePaginatedChannels.ts
@@ -46557,7 +46567,7 @@ var useUserPresenceChangedListener = (setChannels) => {
46557
46567
  return () => {
46558
46568
  client.off("user.presence.changed", handleEvent);
46559
46569
  };
46560
- }, []);
46570
+ }, [client, setChannels]);
46561
46571
  };
46562
46572
 
46563
46573
  // src/components/ChannelSearch/ChannelSearch.tsx
@@ -47324,7 +47334,9 @@ var UnMemoizedChannelList = (props) => {
47324
47334
  setActiveChannel(channels2[0], watchers);
47325
47335
  }
47326
47336
  };
47327
- const forceUpdate = () => setChannelUpdateCount((count) => count + 1);
47337
+ const forceUpdate = (0, import_react212.useCallback)(() => setChannelUpdateCount((count) => count + 1), [
47338
+ setChannelUpdateCount
47339
+ ]);
47328
47340
  const onSearch = (0, import_react212.useCallback)((event) => {
47329
47341
  if (!event.target.value) {
47330
47342
  setSearchActive(false);