BugFix for feed not updating after change in follows.

This commit is contained in:
Vitor Pamplona
2023-06-16 14:30:22 -04:00
parent e50dff3b62
commit 012c7a7105
@@ -138,14 +138,9 @@ fun WatchAccountForHomeScreen(
accountViewModel: AccountViewModel accountViewModel: AccountViewModel
) { ) {
val accountState by accountViewModel.accountLiveData.observeAsState() val accountState by accountViewModel.accountLiveData.observeAsState()
val followState by accountViewModel.account.userProfile().live().follows.observeAsState()
var firstTime by remember(accountViewModel) { mutableStateOf(true) } LaunchedEffect(accountViewModel, accountState?.account?.defaultHomeFollowList, followState) {
LaunchedEffect(accountViewModel, accountState?.account?.defaultHomeFollowList) {
// Only invalidate when things change. Not in the first run
if (firstTime) {
firstTime = false
} else {
launch(Dispatchers.IO) { launch(Dispatchers.IO) {
NostrHomeDataSource.invalidateFilters() NostrHomeDataSource.invalidateFilters()
homeFeedViewModel.invalidateDataAndSendToTop(true) homeFeedViewModel.invalidateDataAndSendToTop(true)
@@ -153,7 +148,6 @@ fun WatchAccountForHomeScreen(
} }
} }
} }
}
@Immutable @Immutable
class TabItem( class TabItem(