mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-17 21:31:57 +01:00
Fixes displaying an old result when coming back to a DVM screen
This commit is contained in:
parent
83235dab69
commit
8b80ac13db
@ -236,8 +236,8 @@ class NostrBookmarkPrivateFeedViewModel(
|
||||
@Stable
|
||||
class NostrNIP90ContentDiscoveryFeedViewModel(
|
||||
val account: Account,
|
||||
val dvmkey: String,
|
||||
val requestid: String,
|
||||
dvmkey: String,
|
||||
requestid: String,
|
||||
) : FeedViewModel(NIP90ContentDiscoveryResponseFilter(account, dvmkey, requestid)) {
|
||||
class Factory(
|
||||
val account: Account,
|
||||
|
@ -204,11 +204,13 @@ fun ObserverContentDiscoveryResponse(
|
||||
}
|
||||
|
||||
val latestResponse by resultFlow.collectAsStateWithLifecycle()
|
||||
val myResponse = latestResponse
|
||||
|
||||
if (latestResponse != null) {
|
||||
if (myResponse != null) {
|
||||
PrepareViewContentDiscoveryModels(
|
||||
noteAuthor,
|
||||
dvmRequestId.idHex,
|
||||
myResponse,
|
||||
onRefresh,
|
||||
accountViewModel,
|
||||
nav,
|
||||
@ -236,6 +238,7 @@ fun ObserverDvmStatusResponse(
|
||||
}
|
||||
|
||||
val latestStatus by statusFlow.collectAsStateWithLifecycle()
|
||||
|
||||
// TODO: Make a good splash screen with loading animation for this DVM.
|
||||
if (latestStatus != null) {
|
||||
// TODO: Make a good splash screen with loading animation for this DVM.
|
||||
@ -252,6 +255,7 @@ fun ObserverDvmStatusResponse(
|
||||
fun PrepareViewContentDiscoveryModels(
|
||||
dvm: User,
|
||||
dvmRequestId: String,
|
||||
latestResponse: NIP90ContentDiscoveryResponseEvent,
|
||||
onRefresh: () -> Unit,
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
@ -262,7 +266,7 @@ fun PrepareViewContentDiscoveryModels(
|
||||
factory = NostrNIP90ContentDiscoveryFeedViewModel.Factory(accountViewModel.account, dvmkey = dvm.pubkeyHex, requestid = dvmRequestId),
|
||||
)
|
||||
|
||||
LaunchedEffect(key1 = dvmRequestId) {
|
||||
LaunchedEffect(key1 = dvmRequestId, latestResponse.id) {
|
||||
resultFeedViewModel.invalidateData()
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ class BiMaxOfCollector<K, V>(
|
||||
v: V,
|
||||
) {
|
||||
if (filter.filter(k, v)) {
|
||||
if (maxK == null || comparator.compare(v, maxV) > 1) {
|
||||
if (maxK == null || comparator.compare(v, maxV) > 0) {
|
||||
maxK = k
|
||||
maxV = v
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user