File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -524,6 +524,8 @@ const ChannelInner = <
524524 return queryResponse . messages . length ;
525525 } ;
526526
527+ const clearHighlightedMessageTimeoutId = useRef < ReturnType < typeof setTimeout > | null > ( null ) ;
528+
527529 const jumpToMessage = async ( messageId : string , messageLimit = 100 ) => {
528530 dispatch ( { loadingMore : true , type : 'setLoadingMore' } ) ;
529531 await channel . state . loadMessageIntoState ( messageId , undefined , messageLimit ) ;
@@ -542,7 +544,12 @@ const ChannelInner = <
542544 type : 'jumpToMessageFinished' ,
543545 } ) ;
544546
545- setTimeout ( ( ) => {
547+ if ( clearHighlightedMessageTimeoutId . current ) {
548+ clearTimeout ( clearHighlightedMessageTimeoutId . current ) ;
549+ }
550+
551+ clearHighlightedMessageTimeoutId . current = setTimeout ( ( ) => {
552+ clearHighlightedMessageTimeoutId . current = null ;
546553 dispatch ( { type : 'clearHighlightedMessage' } ) ;
547554 } , 500 ) ;
548555 } ;
You can’t perform that action at this time.
0 commit comments