From 9e81c15350d8bea4766144f0ca2c3590e20fe4bf Mon Sep 17 00:00:00 2001 From: null Date: Sat, 11 Jul 2026 20:42:04 -0500 Subject: [PATCH] perf(home): @Immutable on HomeAction/PendingActionCard/HomeCategorySummary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/src/main/java/app/closer/ui/home/HomeModels.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/app/closer/ui/home/HomeModels.kt b/app/src/main/java/app/closer/ui/home/HomeModels.kt index cc25b060..af550d7d 100644 --- a/app/src/main/java/app/closer/ui/home/HomeModels.kt +++ b/app/src/main/java/app/closer/ui/home/HomeModels.kt @@ -1,5 +1,6 @@ package app.closer.ui.home +import androidx.compose.runtime.Immutable import app.closer.core.navigation.AppRoute import app.closer.domain.model.GameType import app.closer.domain.model.LocalAnswer @@ -13,6 +14,9 @@ import app.closer.domain.model.QuestionCategory * 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( val category: QuestionCategory, val questionCount: Int @@ -52,6 +56,9 @@ enum class HomeActionTone { Pending } +// @Immutable: only String/enum/primitive fields → the single-instance card params +// (primaryAction, secondary/feed items) become value-skippable. +@Immutable data class HomeAction( val eyebrow: String, val title: String, @@ -66,6 +73,8 @@ data class HomeAction( val gameRoute: String? = null ) +// @Immutable: only String/Int/enum fields → the pending-card params become value-skippable. +@Immutable data class PendingActionCard( val title: String, val subtitle: String?,