Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

perf: enforce stable phase 2 list keys

David Nashash21201c295c96
diff --git a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
index 9089154c..785d58ad 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
@@ -50,7 +50,7 @@ fun <T : Any> CategoryRow(
onSeeAll: (() -> Unit)? = null,
onPinToggle: (() -> Unit)? = null,
isPinned: Boolean = false,
- keySelector: ((T) -> Any)? = null,
+ keySelector: (T) -> Any,
contentTypeSelector: ((T) -> Any?)? = null,
itemContent: @Composable (T) -> Unit
) {
@@ -153,7 +153,7 @@ fun <T : Any> CategoryRow(
) {
items(
items = items,
- key = keySelector, // null = index-based keys (safe default)
+ key = keySelector,
contentType = resolvedContentTypeSelector
) { item ->
itemContent(item)
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsNavigationRail.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsNavigationRail.kt
index 2b294e71..5635479f 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsNavigationRail.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsNavigationRail.kt
@@ -18,6 +18,7 @@ import com.streamvault.app.R
import com.streamvault.app.ui.theme.Primary
private data class SettingsNavEntry(
+ val id: String,
val label: String,
val icon: String,
val accent: Color
@@ -31,41 +32,49 @@ internal fun SettingsNavigationRail(
) {
val entries = listOf(
SettingsNavEntry(
+ id = "providers",
label = stringResource(R.string.settings_providers),
icon = "P",
accent = Primary
),
SettingsNavEntry(
+ id = "playback",
label = stringResource(R.string.settings_playback),
icon = ">",
accent = Color(0xFF9E8FFF)
),
SettingsNavEntry(
+ id = "browsing",
label = stringResource(R.string.settings_browsing),
icon = "#",
accent = Color(0xFF26A69A)
),
SettingsNavEntry(
+ id = "privacy",
label = stringResource(R.string.settings_privacy),
icon = "L",
accent = Color(0xFFFFB74D)
),
SettingsNavEntry(
+ id = "recording",
label = stringResource(R.string.settings_recording_title),
icon = "R",
accent = Color(0xFFEF5350)
),
SettingsNavEntry(
+ id = "backup_restore",
label = stringResource(R.string.settings_backup_restore),
icon = "B",
accent = Color(0xFF42A5F5)
),
SettingsNavEntry(
+ id = "epg_sources",
label = "EPG Sources",
icon = "E",
accent = Color(0xFF66BB6A)
),
SettingsNavEntry(
+ id = "about",
label = stringResource(R.string.settings_about),
icon = "i",
accent = Color(0xFF78909C)
@@ -80,7 +89,11 @@ internal fun SettingsNavigationRail(
contentPadding = PaddingValues(top = 76.dp, bottom = 16.dp),
verticalArrangement = Arrangement.spacedBy(2.dp)
) {
- itemsIndexed(entries) { index, entry ->
+ itemsIndexed(
+ items = entries,
+ key = { _, entry -> entry.id },
+ contentType = { _, _ -> "settings_navigation_entry" }
+ ) { index, entry ->
SettingsNavItem(
label = entry.label,
badgeChar = entry.icon,
@@ -91,4 +104,4 @@ internal fun SettingsNavigationRail(
)
}
}
-}
\ No newline at end of file
+}
diff --git a/docs/COMPOSE_REDUCTION_PHASE2_LIST_AUDIT.md b/docs/COMPOSE_REDUCTION_PHASE2_LIST_AUDIT.md
index ccff94d7..3fe8654e 100644
--- a/docs/COMPOSE_REDUCTION_PHASE2_LIST_AUDIT.md
+++ b/docs/COMPOSE_REDUCTION_PHASE2_LIST_AUDIT.md
@@ -26,10 +26,12 @@ otherwise difficult for Compose to classify.
| M3U series-assignment dialog | Channel ID | `series_assignment` | Fixed. |
| Player quick-action row | Semantic `PlayerActionSpec.id` | `player_quick_action` | Fixed; labels can change for mute, casting, playback speed, aspect ratio, or timer state without changing item identity. |
| Channel-info action tray | Existing `label:index` composite | `channel_info_action` | Reviewed; the private action type has no semantic ID, so the short homogeneous tray retains its collision-safe composite key. |
+| Settings navigation rail | Stable `SettingsNavEntry.id` | `settings_navigation_entry` | Fixed; the static rail now has explicit item identity and content type. |
No display-text key was introduced where a stable domain ID was available. The
private channel-info action type has no domain ID, so its short tray keeps the
existing collision-safe `label:index` key.
The channel progress clock is collected once by Dashboard, Home, and Search;
`ChannelCard` and `LiveChannelRowCard` now receive the timestamp as a value and
-do not collect a flow from inside a lazy-list item.
+do not collect a flow from inside a lazy-list item. `CategoryRow` now requires a
+key selector, preventing future callers from silently opting into index keys.