refactor(#103): centralize navigation mutations through NavigationController.resetTo() (#164)

* refactor(#103): centralize navigation mutations through NavigationController.resetTo()

* fix(chat): fix scroll-to-bottom FAB compilation errors
This commit is contained in:
M57
2026-06-20 17:01:37 +03:00
committed by GitHub
parent ff4649b601
commit 8c9c11df23
2 changed files with 6 additions and 4 deletions
@@ -326,8 +326,7 @@ fun MainNavigation(sessionId: String? = null) {
entry<ConnectScreen> {
ConnectScreenContent(
onConnected = {
backStack.clear()
backStack.add(ChatScreen)
NavigationController.resetTo(ChatScreen)
},
modifier = Modifier.safeDrawingPadding(),
)
@@ -49,8 +49,11 @@ object NavigationController {
stack.add(key)
}
fun add(key: NavKey) {
backStack?.add(key)
/** Clear the stack and navigate to the given screen atomically. */
fun resetTo(screen: NavKey) {
val stack = backStack ?: return
stack.clear()
stack.add(screen)
}
/**