From 81ab25fbbcbf1aca9de3c4715a6d3e6f1940b8bc Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 20 Apr 2026 21:40:27 +0000 Subject: [PATCH] fix(communities): always show Save on the edit screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The edit/create top bar was keyed on model.isEditing(), which reads existingDTag set by loadFrom(). loadFrom runs in a LaunchedEffect after the first composition, so the first render of the edit screen briefly showed the "Create" button before flipping to "Save". Derive the top bar from the `editing: Address?` parameter instead — it is known synchronously at composition, so edit mode shows "Save" on frame one. --- .../communities/newCommunity/NewCommunityScreen.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt index bef4e8283..456a577c3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/newCommunity/NewCommunityScreen.kt @@ -150,9 +150,12 @@ private fun CommunityFormScreen( Scaffold( topBar = { - val titleRes = - if (model.isEditing()) R.string.edit_community else R.string.new_community - if (model.isEditing()) { + // Derive the top bar from the parameter, not model.isEditing(), so the + // first composition of the edit screen already shows "Save" before + // loadFrom() runs in its LaunchedEffect. + val isEditing = editing != null + val titleRes = if (isEditing) R.string.edit_community else R.string.new_community + if (isEditing) { ActionTopBar( titleRes = titleRes, postRes = R.string.save,