Reconcile removed Anime roots without discarding pushed pages
All checks were successful
review/code-gpt GPT review blocker B1 (Anime root removal strands Back) fixed: delta read by firstmate (ShellState reconciles route/root to Home, preservePushed replaces stack root, 111-line regression, 16 targeted tests green); all other review areas cleared on 9e15dbee

This commit is contained in:
justinzeus 2026-11-06 13:11:08 +01:00
parent 9e15dbee8c
commit 6e0f9952cf
4 changed files with 133 additions and 5 deletions

View file

@ -11,7 +11,7 @@ data class ShellPerson(val key: String, val name: String, val initial: String, v
/** The shell owns keys; the integration owns navigation and authenticated user changes. */
sealed interface ShellAction {
data class Destination(val route: String) : ShellAction
data class Destination(val route: String, val preservePushed: Boolean = false) : ShellAction
data class Person(val person: ShellPerson) : ShellAction
data class HandOff(val group: String) : ShellAction
data object Pop : ShellAction
@ -59,8 +59,14 @@ class ShellState(
people = value
if (selected != null) person = selected
pickerIndex = people.indexOf(person).coerceAtLeast(0)
val removedRoot = rootRoute !in tabs
if (removedRoot) {
if (route == rootRoute) route = "home"
rootRoute = "home"
}
preparePersonMemory()
navIndex = if (avatarFocused) tabs.size else tabs.indexOf(focusedTab).takeIf { it >= 0 } ?: currentTab
if (removedRoot) onAction(ShellAction.Destination("home", preservePushed = true))
}
var person by mutableStateOf(people.firstOrNull { it.key == initialPerson } ?: people.first())
private set