perf(home): @Immutable on HomeAction/PendingActionCard/HomeCategorySummary
Part 2b (Compose stack advantage). Marks the three verified-deeply-immutable card models @Immutable so their single-instance params get structural-equality skipping (upgrade over the K2 reference-equality strong-skipping default). HomeAnswerStats/HomeUiState left unannotated (LocalAnswer/Question/Set transitive types not fully audited — a false @Immutable promise would cause stale UI). Rendered output identical; only recomposition frequency drops. compile green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
7be9a1bf15
commit
9e81c15350
|
|
@ -1,5 +1,6 @@
|
||||||
package app.closer.ui.home
|
package app.closer.ui.home
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
import app.closer.core.navigation.AppRoute
|
import app.closer.core.navigation.AppRoute
|
||||||
import app.closer.domain.model.GameType
|
import app.closer.domain.model.GameType
|
||||||
import app.closer.domain.model.LocalAnswer
|
import app.closer.domain.model.LocalAnswer
|
||||||
|
|
@ -13,6 +14,9 @@ import app.closer.domain.model.QuestionCategory
|
||||||
* ViewModel. Behavior-identical to the originals.
|
* ViewModel. Behavior-identical to the originals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @Immutable: deeply immutable (QuestionCategory is all String vals) → structural-equality skipping
|
||||||
|
// for the category cards, an upgrade over the reference-equality strong-skipping default.
|
||||||
|
@Immutable
|
||||||
data class HomeCategorySummary(
|
data class HomeCategorySummary(
|
||||||
val category: QuestionCategory,
|
val category: QuestionCategory,
|
||||||
val questionCount: Int
|
val questionCount: Int
|
||||||
|
|
@ -52,6 +56,9 @@ enum class HomeActionTone {
|
||||||
Pending
|
Pending
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Immutable: only String/enum/primitive fields → the single-instance card params
|
||||||
|
// (primaryAction, secondary/feed items) become value-skippable.
|
||||||
|
@Immutable
|
||||||
data class HomeAction(
|
data class HomeAction(
|
||||||
val eyebrow: String,
|
val eyebrow: String,
|
||||||
val title: String,
|
val title: String,
|
||||||
|
|
@ -66,6 +73,8 @@ data class HomeAction(
|
||||||
val gameRoute: String? = null
|
val gameRoute: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// @Immutable: only String/Int/enum fields → the pending-card params become value-skippable.
|
||||||
|
@Immutable
|
||||||
data class PendingActionCard(
|
data class PendingActionCard(
|
||||||
val title: String,
|
val title: String,
|
||||||
val subtitle: String?,
|
val subtitle: String?,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue