Avoid concurrency issues when reordering categories

Maybe fixes #8372

(cherry picked from commit e2179a6669)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryScreenModel.kt
This commit is contained in:
arkon
2022-11-22 23:12:23 -05:00
committed by Jobobby04
parent aefdc2adbe
commit 36b1b4ed5f
4 changed files with 53 additions and 37 deletions
@@ -96,8 +96,7 @@ fun ChangeCategoryDialog(
val index = selection.indexOf(it)
if (index != -1) {
val mutableList = selection.toMutableList()
mutableList.removeAt(index)
mutableList.add(index, it.next())
mutableList[index] = it.next()
selection = mutableList.toList()
}
}
@@ -64,8 +64,7 @@ fun DeleteLibraryMangaDialog(
val onCheck = {
val index = list.indexOf(state)
val mutableList = list.toMutableList()
mutableList.removeAt(index)
mutableList.add(index, state.next() as CheckboxState.State<Int>)
mutableList[index] = state.next() as CheckboxState.State<Int>
list = mutableList.toList()
}