@@ -121,7 +121,11 @@ const ChannelList = (props) => {
121121 useMobileNavigation ( channelListRef , navOpen , closeMobileNav ) ;
122122
123123 // All the event listeners
124- useMessageNewListener ( setChannels , props . lockChannelOrder ) ;
124+ useMessageNewListener (
125+ setChannels ,
126+ props . lockChannelOrder ,
127+ props . allowNewMessagesFromUnfilteredChannels ,
128+ ) ;
125129 useNotificationMessageNewListener ( setChannels , props . onMessageNew ) ;
126130 useNotificationAddedToChannelListener ( setChannels , props . onAddedToChannel ) ;
127131 useNotificationRemovedFromChannelListener (
@@ -381,6 +385,18 @@ ChannelList.propTypes = {
381385 * If true, channels won't be dynamically sorted by most recent message.
382386 */
383387 lockChannelOrder : PropTypes . bool ,
388+ /**
389+ * When client receives an event `message.new`, we push that channel to top of the list.
390+ *
391+ * But If the channel doesn't exist in the list, then we get the channel from client
392+ * (client maintains list of watched channels as `client.activeChannels`) and push
393+ * that channel to top of the list by default. You can disallow this behavior by setting following
394+ * prop to false. This is quite usefull where you have multiple tab structure and you don't want
395+ * ChannelList in Tab1 to react to new message on some channel in Tab2.
396+ *
397+ * Default value is true.
398+ */
399+ allowNewMessagesFromUnfilteredChannels : PropTypes . bool ,
384400} ;
385401
386402export default React . memo ( ChannelList ) ;
0 commit comments