From 1aea7fbd031cf483e14d8449922d80e6cf371bd9 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 21 Aug 2024 14:58:01 -0400 Subject: [PATCH] Avoids remembering edit lists that will never exist. --- .../main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt | 2 +- .../vitorpamplona/amethyst/ui/note/types/TextModification.kt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 67a1cd522..a48c7e45c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -1014,7 +1014,7 @@ fun observeEdits( accountViewModel: AccountViewModel, ): State> { if (baseNote.event !is TextNoteEvent) { - return remember { mutableStateOf(GenericLoadable.Empty()) } + return EmptyState } val editState = diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt index a83e6e20a..193106b3a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/TextModification.kt @@ -223,6 +223,8 @@ fun RenderTextModificationEvent( } } +val EmptyState = mutableStateOf>(GenericLoadable.Empty()) + @Stable class EditState { private var modificationsList: List = persistentListOf()