perf: skip catchup MessageFrame|s

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-06-05 14:51:02 +02:00
parent 9db45a4513
commit 39433efb15
1 changed files with 2 additions and 0 deletions

View File

@ -460,6 +460,8 @@ class ChannelScreenViewModel @Inject constructor(
when (it) {
is MessageFrame -> {
if (it.channel != channel?.id) return@onEach
// If we already have the message we are just catching up on the WebSocket connection. Skip
if (items.any { m -> (m is ChannelScreenItem.RegularMessage && m.message.id == it.id) || (m is ChannelScreenItem.SystemMessage && m.message.id == it.id) }) return@onEach
it.author?.let { userId ->
if (RevoltAPI.userCache[userId] == null) {