Attempt to fix room list item duplicates at midnight (#6793)
* Attempt to fix room list item duplicates at midnight This seems to happen because of a race condition between `RoomListDataSource.observeDateTimeChanges` and `RoomListDataSource.replaceWith` being called at almost the same time and the first one using the newly received items from observing the timeline items but not updating the cache which will be later reused by `replaceWith`, containing incorrect indices
This commit is contained in:
parent
c2ec69e1c9
commit
603c4feda1
2 changed files with 66 additions and 2 deletions
|
|
@ -83,8 +83,8 @@ class RoomListDataSource(
|
|||
|
||||
val loadingState = roomList.loadingState
|
||||
|
||||
fun launchIn(coroutineScope: CoroutineScope) {
|
||||
roomList
|
||||
fun launchIn(coroutineScope: CoroutineScope): Job {
|
||||
return roomList
|
||||
.summaries
|
||||
.onEach { roomSummaries ->
|
||||
replaceWith(roomSummaries)
|
||||
|
|
@ -212,6 +212,7 @@ class RoomListDataSource(
|
|||
private suspend fun rebuildAllRoomSummaries() {
|
||||
lock.withLock {
|
||||
roomList.summaries.replayCache.firstOrNull()?.let { roomSummaries ->
|
||||
diffCacheUpdater.updateWith(roomSummaries)
|
||||
buildAndEmitAllRooms(roomSummaries, useCache = false)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue