Skip to content

Commit

Permalink
Avoid minor allocation in CollectionPage
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed May 25, 2024
1 parent ca306ba commit 9fe92ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/shared/pages/subject-collection/common/CollectionPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ fun CollectionPage(
if (size == null) {
Text(text = collectionType.displayText())
} else {
Text(text = collectionType.displayText() + " " + size)
Text(text = remember(collectionType, size) {
collectionType.displayText() + " " + size
})
}
}
)
Expand Down Expand Up @@ -307,6 +309,7 @@ private fun TabContent(
)
}

@Stable
private fun UnifiedCollectionType.displayText(): String {
return when (this) {
UnifiedCollectionType.WISH -> "想看"
Expand Down

0 comments on commit 9fe92ff

Please sign in to comment.