Concurrent modification exception bugfix

pull/55/head
Vitor Pamplona 2023-01-25 19:09:18 -03:00
rodzic a9788cfa63
commit bd7a4a8372
2 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -25,8 +25,11 @@ object NostrThreadDataSource: NostrDataSource<Note>("SingleThreadFeed") {
}
fun createLoadEventsIfNotLoadedFilter(): JsonFilter? {
val eventsToLoad = eventsToWatch
.map { LocalCache.notes[it] }
val nodes = synchronized(eventsToWatch) {
eventsToWatch.map { LocalCache.notes[it] }
}
val eventsToLoad = nodes
.filterNotNull()
.filter { it.event == null }
.map { it.idHex.substring(0, 8) }
@ -85,7 +88,9 @@ object NostrThreadDataSource: NostrDataSource<Note>("SingleThreadFeed") {
thread.add(note)
threadSet.add(note)
note.replies.forEach {
synchronized(note.replies) {
note.replies.toList()
}.forEach {
loadDown(it, thread, threadSet)
}
}

Wyświetl plik

@ -79,8 +79,6 @@ fun HomeScreen(accountViewModel: AccountViewModel, navController: NavController)
1 -> FeedView(feedViewModelReplies, accountViewModel, navController)
}
}
}
}
}