mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 16:57:39 +00:00
Merge pull request #3074 from vitorpamplona/claude/gallant-darwin-VfniN
Fix route hint re-firing on activity recreation
This commit is contained in:
@@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
+3
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user