Reduce recomposition of MangaHeader (#9985)

* Reduce recomposition of MangaHeader

* Reuse `Modifier` for `Tags`

Reference:
https://developer.android.com/jetpack/compose/modifiers#reusing-modifiers

* Don't recalculate Read State on recomposition

* Fix Linting issue

* Optimize chapter state calculations
This commit is contained in:
LooKeR
2023-10-07 03:54:43 +05:30
committed by GitHub
parent 7f0f67d752
commit 78aa50bb35
2 changed files with 69 additions and 33 deletions
@@ -286,7 +286,7 @@ fun ExpandableMangaDescription(
) {
tags.forEach {
TagsChip(
modifier = Modifier.padding(vertical = 4.dp),
modifier = DefaultTagChipModifier,
text = it,
onClick = {
tagSelected = it
@@ -302,7 +302,7 @@ fun ExpandableMangaDescription(
) {
items(items = tags) {
TagsChip(
modifier = Modifier.padding(vertical = 4.dp),
modifier = DefaultTagChipModifier,
text = it,
onClick = {
tagSelected = it
@@ -654,6 +654,8 @@ private fun MangaSummary(
}
}
private val DefaultTagChipModifier = Modifier.padding(vertical = 4.dp)
@Composable
private fun TagsChip(
text: String,