Only changes Username if value changes.

This commit is contained in:
Vitor Pamplona
2023-10-17 18:09:39 -04:00
parent e703c08634
commit 1e83dbfbe3
@@ -21,6 +21,7 @@ import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.distinctUntilChanged
import androidx.lifecycle.map
import com.vitorpamplona.amethyst.model.Note
import com.vitorpamplona.amethyst.model.User
@@ -35,7 +36,7 @@ import com.vitorpamplona.quartz.events.ImmutableListOfLists
fun NoteUsernameDisplay(baseNote: Note, weight: Modifier = Modifier, showPlayButton: Boolean = true, textColor: Color = Color.Unspecified) {
val authorState by baseNote.live().metadata.map {
it.note.author
}.observeAsState(baseNote.author)
}.distinctUntilChanged().observeAsState(baseNote.author)
Crossfade(targetState = authorState, modifier = weight) {
it?.let {