Fix race condition when updating search items in SearchViewModel (#4037)

This commit is contained in:
Chopper
2026-10-03 09:11:04 +00:00
committed by GitHub
parent a4780e4edb
commit 4c88f02646
@@ -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) {