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,19 +138,13 @@ 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) {
launch(Dispatchers.IO) {
LaunchedEffect(accountViewModel, accountState?.account?.defaultHomeFollowList) { NostrHomeDataSource.invalidateFilters()
// Only invalidate when things change. Not in the first run homeFeedViewModel.invalidateDataAndSendToTop(true)
if (firstTime) { repliesFeedViewModel.invalidateDataAndSendToTop(true)
firstTime = false
} else {
launch(Dispatchers.IO) {
NostrHomeDataSource.invalidateFilters()
homeFeedViewModel.invalidateDataAndSendToTop(true)
repliesFeedViewModel.invalidateDataAndSendToTop(true)
}
} }
} }
} }