BugFix for feed not updating after change in follows.
This commit is contained in:
@@ -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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user