@@ -63,7 +63,6 @@ import {
6363import { findInMsgSetByDate , findInMsgSetById , makeAddNotifications } from './utils' ;
6464import { useThreadContext } from '../Threads' ;
6565import { getChannel } from '../../utils' ;
66- import { useStateStore } from '../../store' ;
6766
6867import type {
6968 APIErrorResponse ,
@@ -76,7 +75,6 @@ import type {
7675 EventAPIResponse ,
7776 Message ,
7877 MessageResponse ,
79- SearchControllerState ,
8078 SendMessageAPIResponse ,
8179 Channel as StreamChannel ,
8280 StreamChat ,
@@ -99,12 +97,7 @@ import {
9997 getVideoAttachmentConfiguration ,
10098} from '../Attachment/attachment-sizing' ;
10199import type { URLEnrichmentConfig } from '../MessageInput/hooks/useLinkPreviews' ;
102-
103- const searchControllerStateSelector = <
104- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics
105- > (
106- nextValue : SearchControllerState < StreamChatGenerics > ,
107- ) => ( { jumpToMessageFromSearch : nextValue . focusedMessage } ) ;
100+ import { useSearchFocusedMessage } from '../../experimental/Search/hooks' ;
108101
109102export type ChannelPropsForwardedToComponentContext <
110103 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics
@@ -396,12 +389,7 @@ const ChannelInner = <
396389 loading : ! channel . initialized ,
397390 } ,
398391 ) ;
399-
400- const { jumpToMessageFromSearch } = useStateStore (
401- searchController . state ,
402- searchControllerStateSelector ,
403- ) ;
404-
392+ const jumpToMessageFromSearch = useSearchFocusedMessage ( ) ;
405393 const isMounted = useIsMounted ( ) ;
406394
407395 const originalTitle = useRef ( '' ) ;
@@ -666,8 +654,8 @@ const ChannelInner = <
666654 clearTimeout ( clearHighlightedMessageTimeoutId . current ) ;
667655 }
668656 clearHighlightedMessageTimeoutId . current = setTimeout ( ( ) => {
669- if ( searchController . state . getLatestValue ( ) . focusedMessage ) {
670- searchController . state . partialNext ( { focusedMessage : undefined } ) ;
657+ if ( searchController . internalState . getLatestValue ( ) . focusedMessage ) {
658+ searchController . internalState . partialNext ( { focusedMessage : undefined } ) ;
671659 }
672660 clearHighlightedMessageTimeoutId . current = null ;
673661 dispatch ( { type : 'clearHighlightedMessage' } ) ;
0 commit comments