Just use remember{} instead of adding derivedStateOf{} to avoid weird state issues.

This commit is contained in:
KotlinGeekDev
2025-09-26 16:21:13 +01:00
parent 61459187d7
commit d2d811f670
@@ -23,7 +23,6 @@ package com.vitorpamplona.amethyst.service.relayClient.reqCommand.user
import android.annotation.SuppressLint import android.annotation.SuppressLint
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.State import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -413,8 +412,9 @@ fun observeUserIsFollowing(
): State<Boolean> { ): State<Boolean> {
// Subscribe in the relay for changes in the metadata of this user. // Subscribe in the relay for changes in the metadata of this user.
UserFinderFilterAssemblerSubscription(user1, accountViewModel) UserFinderFilterAssemblerSubscription(user1, accountViewModel)
val isUserInFollowSets by remember(accountViewModel.account.followSetsState) { val isUserInFollowSets =
derivedStateOf { accountViewModel.account.followSetsState.isUserInFollowSets(user2) } remember(accountViewModel.account.followSetsState) {
accountViewModel.account.followSetsState.isUserInFollowSets(user2)
} }
// Subscribe in the LocalCache for changes that arrive in the device // Subscribe in the LocalCache for changes that arrive in the device