perf: use drawBehind for background color to avoid recomposition

Replace background(backgroundColor.value) with drawBehind { drawRect() }
so the color state is read during the draw phase, not composition.
This prevents NoteComposeLayout from recomposing when the "new item"
background color changes after 5 seconds.

https://claude.ai/code/session_01Fam5VHNaNkKBBafg1gRfFS
This commit is contained in:
Claude
2026-04-05 13:55:12 +00:00
parent 002d7e631d
commit b7ecdaf2e6
@@ -51,6 +51,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.compositeOver
@@ -638,7 +639,10 @@ fun InnerNoteWithReactions(
val showSecondRow = isNotRepost && notBoostedNorQuote && accountViewModel.settings.isCompleteUIMode()
NoteComposeLayout(
modifier = clickModifier.background(backgroundColor.value).fillMaxWidth(),
modifier =
clickModifier
.drawBehind { drawRect(backgroundColor.value) }
.fillMaxWidth(),
addPadding = !isBoostedNote,
showAuthorColumn = notBoostedNorQuote,
showSecondRow = showSecondRow,