mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-16 13:48:09 -07:00
Fix race condition when updating search items in SearchViewModel (#4037)
This commit is contained in:
+6
-1
@@ -195,7 +195,12 @@ abstract class SearchViewModel(
|
||||
}
|
||||
|
||||
private fun updateItem(source: Source, result: SearchItemResult) {
|
||||
updateItems(state.value.items + (source to result))
|
||||
state.update { currentState ->
|
||||
val newItems = currentState.items + (source to result)
|
||||
currentState.copy(
|
||||
items = newItems.toSortedMap(sortComparator(newItems)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun setMigrateDialog(currentId: Long, target: Manga) {
|
||||
|
||||
Reference in New Issue
Block a user