File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1064,6 +1064,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
10641064 if ( failedMessages ?. length ) {
10651065 channel . state . addMessagesSorted ( failedMessages ) ;
10661066 }
1067+ await markRead ( ) ;
10671068 channel . state . setIsUpToDate ( true ) ;
10681069 } else {
10691070 await reloadThread ( ) ;
Original file line number Diff line number Diff line change @@ -415,10 +415,20 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
415415 }
416416 } ) ;
417417
418+ const messagesLength = useRef < number > ( processedMessageList . length ) ;
419+
418420 /**
419421 * This function should show or hide the unread indicator depending on the
420422 */
421423 const updateStickyUnreadIndicator = useStableCallback ( ( viewableItems : ViewToken [ ] ) => {
424+ // we need this check to make sure that regular list change do not trigger
425+ // the unread notification to appear (for example if the old last read messages
426+ // go out of the viewport).
427+ if ( processedMessageList . length !== messagesLength . current ) {
428+ return ;
429+ }
430+ messagesLength . current = processedMessageList . length ;
431+
422432 if ( ! viewableItems . length ) {
423433 setIsUnreadNotificationOpen ( false ) ;
424434 return ;
@@ -737,10 +747,12 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
737747 const isLastReadMessage =
738748 channelUnreadState ?. last_read_message_id === message . id ||
739749 ( ! channelUnreadState ?. unread_messages && createdAtTimestamp === lastReadTimestamp ) ;
750+ const isMyMessage = message . user ?. id === client . userID ;
740751
741752 const showUnreadSeparator =
742753 isLastReadMessage &&
743754 ! isNewestMessage &&
755+ ! isMyMessage &&
744756 // The `channelUnreadState?.first_unread_message_id` is here for sent messages unread label
745757 ( ! ! channelUnreadState ?. first_unread_message_id || ! ! channelUnreadState ?. unread_messages ) ;
746758
You can’t perform that action at this time.
0 commit comments