@@ -23,7 +23,6 @@ import androidx.compose.material.pullrefresh.rememberPullRefreshState
2323import androidx.compose.material3.VerticalDivider
2424import androidx.compose.runtime.Composable
2525import androidx.compose.runtime.LaunchedEffect
26- import androidx.compose.runtime.collectAsState
2726import androidx.compose.runtime.derivedStateOf
2827import androidx.compose.runtime.getValue
2928import androidx.compose.runtime.mutableStateOf
@@ -36,6 +35,7 @@ import androidx.compose.ui.res.painterResource
3635import androidx.compose.ui.res.stringResource
3736import androidx.compose.ui.tooling.preview.Preview
3837import androidx.compose.ui.unit.dp
38+ import androidx.lifecycle.compose.collectAsStateWithLifecycle
3939import androidx.navigation.NavController
4040import androidx.navigation.compose.NavHost
4141import androidx.navigation.compose.composable
@@ -84,7 +84,7 @@ fun HomeScreen(
8484 activityListViewModel : ActivityListViewModel ,
8585 rootNavController : NavController ,
8686) {
87- val uiState: MainUiState by walletViewModel.uiState.collectAsState ()
87+ val uiState: MainUiState by walletViewModel.uiState.collectAsStateWithLifecycle ()
8888 val currentSheet by appViewModel.currentSheet
8989
9090 SheetHost (
@@ -141,7 +141,7 @@ fun HomeScreen(
141141 enterTransition = { screenSlideIn },
142142 exitTransition = { screenSlideOut },
143143 ) {
144- val hasSeenSpendingIntro by appViewModel.hasSeenSpendingIntro.collectAsState ()
144+ val hasSeenSpendingIntro by appViewModel.hasSeenSpendingIntro.collectAsStateWithLifecycle ()
145145 SavingsWalletScreen (
146146 onAllActivityButtonClick = { walletNavController.navigate(HomeRoutes .AllActivity ) },
147147 onActivityItemClick = { rootNavController.navigateToActivityItem(it) },
@@ -160,7 +160,7 @@ fun HomeScreen(
160160 enterTransition = { screenSlideIn },
161161 exitTransition = { screenSlideOut },
162162 ) {
163- val hasSeenSavingsIntro by appViewModel.hasSeenSavingsIntro.collectAsState ()
163+ val hasSeenSavingsIntro by appViewModel.hasSeenSavingsIntro.collectAsStateWithLifecycle ()
164164 SpendingWalletScreen (
165165 uiState = uiState,
166166 onAllActivityButtonClick = { walletNavController.navigate(HomeRoutes .AllActivity ) },
@@ -215,7 +215,7 @@ private fun HomeContentView(
215215 RequestNotificationPermissions ()
216216 val balances = LocalBalances .current
217217 val app = appViewModel ? : return @AppScaffold
218- val showEmptyStateSetting by app.showEmptyState.collectAsState ()
218+ val showEmptyStateSetting by app.showEmptyState.collectAsStateWithLifecycle ()
219219 val showEmptyState by remember(balances.totalSats, showEmptyStateSetting) {
220220 derivedStateOf {
221221 showEmptyStateSetting && balances.totalSats == 0uL
@@ -265,7 +265,7 @@ private fun HomeContentView(
265265 Text13Up (stringResource(R .string.wallet__activity), color = Colors .White64 )
266266 Spacer (modifier = Modifier .height(16 .dp))
267267 val activity = activityListViewModel ? : return @Column
268- val latestActivities by activity.latestActivities.collectAsState ()
268+ val latestActivities by activity.latestActivities.collectAsStateWithLifecycle ()
269269 ActivityList (
270270 items = latestActivities,
271271 onAllActivityClick = { walletNavController.navigate(HomeRoutes .AllActivity ) },
0 commit comments