diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt index b889c808b3..b2b1f1ef36 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt @@ -1325,13 +1325,17 @@ class TimelineViewModel @AssistedInject constructor( computeUnreadState(timelineEvents, roomSummary) } // We don't want live update of unread so we skip when we already had a HasUnread or HasNoUnread - // However, we want to update an existing HasUnread, if the readMarkerId hasn't changed, + // However, we want to update an existing HasUnread, if the readMarkerId hasn't changed or when we go back in live, // as we might be loading new events to fill gaps in the timeline. .distinctUntilChanged { previous, current -> when { previous is UnreadState.Unknown || previous is UnreadState.ReadMarkerNotLoaded -> false previous is UnreadState.HasUnread && current is UnreadState.HasUnread && previous.readMarkerId == current.readMarkerId -> false + previous is UnreadState.HasUnread && ( + current is UnreadState.HasUnread && previous.firstUnreadEventId != current.firstUnreadEventId || + current is UnreadState.HasNoUnread + ) && timeline?.isLive.orFalse() -> false current is UnreadState.HasUnread || current is UnreadState.HasNoUnread -> true else -> false }