fix: quoted NoteCompose stuck on the "new item" purple background

calculateBackgroundColor captured parentBackgroundColor?.value once inside
remember(createdAt), so an inner NoteCompose (repost or reply preview) that
first composed while the outer was still highlighted would snapshot the
purple color and never observe the outer's fade back to the default
background.

- Repost inner notes now share the parent's bgColor State directly when
  they have no own read-tracking, so they fade in lockstep with the outer.
- Reply previews no longer receive parentBackgroundColor at all; they rely
  on replyModifier for their own visual style and never inherit the
  purple "new item" highlight from the surrounding post.
This commit is contained in:
Claude
2026-05-16 18:45:26 +00:00
parent f108ba9050
commit 523b0616cf
3 changed files with 8 additions and 7 deletions
@@ -490,9 +490,12 @@ fun calculateBackgroundColor(
val defaultBackgroundColor = MaterialTheme.colorScheme.background
val newItemColor = MaterialTheme.colorScheme.newItemBackgroundColor
// Only fade in/out the "new item" highlight for items that track read state.
// Inner notes (reposts/quotes) pass routeForLastRead = null and reuse the parent color directly,
// so the LaunchedEffect would just park a coroutine for 5s per item during scroll.
// Inner notes (reposts) pass routeForLastRead = null with the parent's bgColor state;
// share it directly so the inner highlight fades in lockstep with the outer.
if (routeForLastRead == null && parentBackgroundColor != null) {
return parentBackgroundColor
}
val isNew =
remember(createdAt, routeForLastRead) {
routeForLastRead != null && accountViewModel.loadAndMarkAsRead(routeForLastRead, createdAt)
@@ -1493,7 +1496,6 @@ fun getGradient(backgroundColor: MutableState<Color>): Brush =
@Composable
fun ReplyNoteComposition(
replyingDirectlyTo: Note,
backgroundColor: MutableState<Color>,
accountViewModel: AccountViewModel,
nav: INav,
) {
@@ -1504,7 +1506,6 @@ fun ReplyNoteComposition(
unPackReply = ReplyRenderType.NONE,
makeItShort = true,
quotesLeft = 0,
parentBackgroundColor = backgroundColor,
accountViewModel = accountViewModel,
nav = nav,
)
@@ -109,7 +109,7 @@ fun RenderTextEvent(
if (replyingDirectlyTo != null && canShowReply) {
when (unPackReply) {
ReplyRenderType.FULL -> {
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav)
Spacer(modifier = StdVertSpacer)
}
@@ -87,7 +87,7 @@ fun RenderZapPoll(
}
}
if (replyingDirectlyTo != null) {
ReplyNoteComposition(replyingDirectlyTo, backgroundColor, accountViewModel, nav)
ReplyNoteComposition(replyingDirectlyTo, accountViewModel, nav)
Spacer(modifier = StdVertSpacer)
}
}