Merge pull request #3074 from vitorpamplona/claude/gallant-darwin-VfniN

Fix route hint re-firing on activity recreation
This commit is contained in:
Vitor Pamplona
2026-05-27 15:33:28 -04:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
@@ -30,6 +30,7 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -119,10 +120,14 @@ fun LoggedInSetup(
state: AccountState.LoggedIn,
accountSessionManager: AccountSessionManager,
) {
// Consume the one-shot route hint set by sign-in/account-switch so it
// can't re-fire when LoggedInPage re-composes after activity recreation
// (rotation, dark-mode toggle, returning from background).
val initialRoute = remember(state) { state.route.also { state.route = null } }
SetAccountCentricViewModelStore(state) {
LoggedInPage(
account = state.account,
route = state.route,
route = initialRoute,
accountSessionManager = accountSessionManager,
)
}
@@ -75,7 +75,9 @@ fun LoggedInPage(
),
)
accountViewModel.firstRoute = route
LaunchedEffect(Unit) {
accountViewModel.firstRoute = route
}
// Adds this account to the authentication procedures for relays.
RelayAuthSubscription(accountViewModel)