Skip to content

Commit

Permalink
Merge pull request #1250 from geovnn/main
Browse files Browse the repository at this point in the history
Keep note state across LazyColumns recompositions
  • Loading branch information
vitorpamplona authored Jan 5, 2025
2 parents 1ca0abf + f1141e6 commit f1d61da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -70,7 +71,7 @@ fun ExpandableRichTextViewer(
nav: INav,
) {
var showFullText by
remember {
rememberSaveable {
val cached = ShowFullTextCache.cache[id]
if (cached == null) {
ShowFullTextCache.cache.put(id, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Alignment.Companion.Center
Expand Down Expand Up @@ -169,7 +170,7 @@ fun ReactionsRow(
accountViewModel: AccountViewModel,
nav: INav,
) {
val wantsToSeeReactions = remember(baseNote) { mutableStateOf(false) }
val wantsToSeeReactions = rememberSaveable(baseNote) { mutableStateOf(false) }

InnerReactionRow(baseNote, showReactionDetail, addPadding, wantsToSeeReactions, editState, accountViewModel, nav)

Expand Down

0 comments on commit f1d61da

Please sign in to comment.