From 6fceb5b2c0a706e1c5c45b0de26f070cda046119 Mon Sep 17 00:00:00 2001 From: shamim-emon Date: Wed, 18 Sep 2024 12:49:40 +0600 Subject: [PATCH] compose-stability errors fixed --- .../src/main/java/com/ivy/loans/loan/LoanScreenMode.kt | 3 --- .../loans/src/main/java/com/ivy/loans/loan/LoansScreen.kt | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/screen/loans/src/main/java/com/ivy/loans/loan/LoanScreenMode.kt b/screen/loans/src/main/java/com/ivy/loans/loan/LoanScreenMode.kt index 6f8baaf406..4d1102c2fc 100644 --- a/screen/loans/src/main/java/com/ivy/loans/loan/LoanScreenMode.kt +++ b/screen/loans/src/main/java/com/ivy/loans/loan/LoanScreenMode.kt @@ -1,8 +1,5 @@ package com.ivy.loans.loan -import androidx.compose.runtime.Immutable - -@Immutable sealed interface LoanScreenMode { data object TabularMode : LoanScreenMode data object NonTabularMode : LoanScreenMode diff --git a/screen/loans/src/main/java/com/ivy/loans/loan/LoansScreen.kt b/screen/loans/src/main/java/com/ivy/loans/loan/LoansScreen.kt index a13f8a3b23..3452ca3454 100644 --- a/screen/loans/src/main/java/com/ivy/loans/loan/LoansScreen.kt +++ b/screen/loans/src/main/java/com/ivy/loans/loan/LoansScreen.kt @@ -99,7 +99,7 @@ private fun BoxWithConstraintsScope.UI( Spacer(Modifier.height(8.dp)) - val scrollState = getLoansListState(state.screenMode, state.selectedTab) + val scrollState = getLoansListState(state) if (state.screenMode == LoanScreenMode.TabularMode) { val loans = if (state.selectedTab == LoanTab.PENDING) { @@ -236,10 +236,10 @@ private fun BoxWithConstraintsScope.UI( } @Composable -private fun getLoansListState(screenMode: LoanScreenMode, selectedTab: LoanTab): LazyListState { - return when (screenMode) { +private fun getLoansListState(state: LoanScreenState): LazyListState { + return when (state.screenMode) { LoanScreenMode.TabularMode -> { - if (selectedTab == LoanTab.PENDING) { + if (state.selectedTab == LoanTab.PENDING) { rememberScrollPositionListState( key = "loans_pending_lazy_column", initialFirstVisibleItemIndex = ivyWalletCtx()