From 1b833df7270701f1f1913890d5b6409823777734 Mon Sep 17 00:00:00 2001 From: hayaksi1 <193020925+hayaksi1@users.noreply.github.com> Date: Mon, 10 Aug 2026 16:36:36 +0300 Subject: [PATCH] Expose the revealed event ids as a SnapshotStateSet Restore the snapshot backed set the store started with and declare allowedEventIds as SnapshotStateSet so the interface says out loud that reads of it are observable. TimelineProtectionPresenter reads the set inside derivedStateOf, so a plain set silently stops the timeline from re-rendering when an event is revealed. Naming the type keeps that requirement from being mistaken for an implementation detail. --- .../timeline/protection/TimelineProtectionStore.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt index 019f4eabd6..aa6655cb86 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/protection/TimelineProtectionStore.kt @@ -7,25 +7,26 @@ package io.element.android.features.messages.impl.timeline.protection -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableStateSetOf +import androidx.compose.runtime.snapshots.SnapshotStateSet import dev.zacsweers.metro.ContributesBinding import dev.zacsweers.metro.SingleIn import io.element.android.libraries.di.SessionScope import io.element.android.libraries.matrix.api.core.EventId interface TimelineProtectionStore { - val allowedEventIds: Set + val allowedEventIds: SnapshotStateSet fun allowEvent(eventId: EventId) } @ContributesBinding(SessionScope::class) @SingleIn(SessionScope::class) class DefaultTimelineProtectionStore : TimelineProtectionStore { - private val allowedEvents = mutableStateOf(emptySet()) + private val allowedEvents = mutableStateSetOf() - override val allowedEventIds: Set get() = allowedEvents.value + override val allowedEventIds: SnapshotStateSet = allowedEvents override fun allowEvent(eventId: EventId) { - allowedEvents.value = allowedEvents.value + eventId + allowedEvents += eventId } }