Slight improvement in the performance of Reaction Row's rendering

This commit is contained in:
Vitor Pamplona 2023-10-28 12:31:44 -04:00
parent 553bebb6cf
commit 2cc9bb8b72

View File

@ -156,11 +156,14 @@ private fun InnerReactionRow(
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
modifier = ReactionRowExpandButton modifier = ReactionRowExpandButton
) { ) {
Row(verticalAlignment = CenterVertically) { val (value, elapsed) = measureTimedValue {
WatchReactionsZapsBoostsAndDisplayIfExists(baseNote) { Row(verticalAlignment = CenterVertically) {
RenderShowIndividualReactionsButton(wantsToSeeReactions) WatchReactionsZapsBoostsAndDisplayIfExists(baseNote) {
RenderShowIndividualReactionsButton(wantsToSeeReactions)
}
} }
} }
Log.d("Rendering Metrics", "Reactions Button: ${baseNote.event?.content()?.split("\n")?.getOrNull(0)?.take(15)}.. $elapsed")
} }
} }
@ -324,10 +327,8 @@ private fun WatchReactionsZapsBoostsAndDisplayIfExists(baseNote: Note, content:
baseNote.reactions.isNotEmpty() baseNote.reactions.isNotEmpty()
) )
Crossfade(targetState = hasReactions) { if (hasReactions) {
if (it) { content()
content()
}
} }
} }