diff --git a/app/src/main/java/chat/stoat/screens/chat/views/channel/ChannelScreenViewModel.kt b/app/src/main/java/chat/stoat/screens/chat/views/channel/ChannelScreenViewModel.kt index ac571556..98467e00 100644 --- a/app/src/main/java/chat/stoat/screens/chat/views/channel/ChannelScreenViewModel.kt +++ b/app/src/main/java/chat/stoat/screens/chat/views/channel/ChannelScreenViewModel.kt @@ -535,6 +535,13 @@ class ChannelScreenViewModel @Inject constructor( } } + // Skip update if ignoreExisting filtered out all messages (e.g. WS reconnect + // fetched the same messages already loaded) — otherwise updateItems([]) wipes the list + if (ignoreExisting && newItems.isEmpty()) { + if (!didInitialChannelFetch) didInitialChannelFetch = true + return@launch + } + // Place items according to whether above/below/around was specified. // TODO: Aditionally, place LoadTriggers at the beginning and end of the list. val newItemsWithPosition = when {