perf: merge ClickableNote Column into NoteComposeLayout modifier
Move the combinedClickable + background modifiers from the wrapping ClickableNote Column directly onto NoteComposeLayout's modifier chain. This eliminates one Column layout node per note item in the feed. The ClickableNote function is preserved for other callers (ChannelCardCompose) but now delegates to clickableNoteModifier. https://claude.ai/code/session_01Fam5VHNaNkKBBafg1gRfFS
This commit is contained in:
@@ -546,17 +546,10 @@ private fun CheckNewAndRenderNote(
|
|||||||
accountViewModel,
|
accountViewModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
ClickableNote(
|
|
||||||
baseNote = baseNote,
|
|
||||||
backgroundColor = backgroundColor,
|
|
||||||
modifier = modifier,
|
|
||||||
accountViewModel = accountViewModel,
|
|
||||||
showPopup = showPopup,
|
|
||||||
nav = nav,
|
|
||||||
) {
|
|
||||||
InnerNoteWithReactions(
|
InnerNoteWithReactions(
|
||||||
baseNote = baseNote,
|
baseNote = baseNote,
|
||||||
backgroundColor = backgroundColor,
|
backgroundColor = backgroundColor,
|
||||||
|
clickModifier = clickableNoteModifier(baseNote, modifier, accountViewModel, showPopup, nav),
|
||||||
isBoostedNote = isBoostedNote,
|
isBoostedNote = isBoostedNote,
|
||||||
isQuotedNote = isQuotedNote,
|
isQuotedNote = isQuotedNote,
|
||||||
unPackReply = unPackReply,
|
unPackReply = unPackReply,
|
||||||
@@ -568,21 +561,17 @@ private fun CheckNewAndRenderNote(
|
|||||||
nav = nav,
|
nav = nav,
|
||||||
moreOptions = moreOptions,
|
moreOptions = moreOptions,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
fun ClickableNote(
|
fun clickableNoteModifier(
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
modifier: Modifier,
|
modifier: Modifier,
|
||||||
backgroundColor: MutableState<Color>,
|
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
showPopup: () -> Unit,
|
showPopup: () -> Unit,
|
||||||
nav: INav,
|
nav: INav,
|
||||||
content: @Composable () -> Unit,
|
): Modifier =
|
||||||
) {
|
|
||||||
val updatedModifier =
|
|
||||||
remember(baseNote, modifier) {
|
remember(baseNote, modifier) {
|
||||||
modifier
|
modifier
|
||||||
.combinedClickable(
|
.combinedClickable(
|
||||||
@@ -608,13 +597,30 @@ fun ClickableNote(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(modifier = updatedModifier.background(backgroundColor.value)) { content() }
|
@Composable
|
||||||
|
fun ClickableNote(
|
||||||
|
baseNote: Note,
|
||||||
|
modifier: Modifier,
|
||||||
|
backgroundColor: MutableState<Color>,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
|
showPopup: () -> Unit,
|
||||||
|
nav: INav,
|
||||||
|
content: @Composable () -> Unit,
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier =
|
||||||
|
clickableNoteModifier(baseNote, modifier, accountViewModel, showPopup, nav)
|
||||||
|
.background(backgroundColor.value),
|
||||||
|
) {
|
||||||
|
content()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun InnerNoteWithReactions(
|
fun InnerNoteWithReactions(
|
||||||
baseNote: Note,
|
baseNote: Note,
|
||||||
backgroundColor: MutableState<Color>,
|
backgroundColor: MutableState<Color>,
|
||||||
|
clickModifier: Modifier = Modifier,
|
||||||
isBoostedNote: Boolean,
|
isBoostedNote: Boolean,
|
||||||
isQuotedNote: Boolean,
|
isQuotedNote: Boolean,
|
||||||
unPackReply: ReplyRenderType,
|
unPackReply: ReplyRenderType,
|
||||||
@@ -632,7 +638,7 @@ fun InnerNoteWithReactions(
|
|||||||
val showSecondRow = isNotRepost && notBoostedNorQuote && accountViewModel.settings.isCompleteUIMode()
|
val showSecondRow = isNotRepost && notBoostedNorQuote && accountViewModel.settings.isCompleteUIMode()
|
||||||
|
|
||||||
NoteComposeLayout(
|
NoteComposeLayout(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = clickModifier.background(backgroundColor.value).fillMaxWidth(),
|
||||||
addPadding = !isBoostedNote,
|
addPadding = !isBoostedNote,
|
||||||
showAuthorColumn = notBoostedNorQuote,
|
showAuthorColumn = notBoostedNorQuote,
|
||||||
showSecondRow = showSecondRow,
|
showSecondRow = showSecondRow,
|
||||||
|
|||||||
Reference in New Issue
Block a user