perf: longPressDraggableHandle

This commit is contained in:
lisonge 2024-02-15 19:38:39 +08:00
parent 5e58901aa6
commit 2eb76cd1cd

View File

@ -293,7 +293,7 @@ fun useSubsManagePage(): ScaffoldExt {
)
Card(
modifier = Modifier
.draggableHandle(onDragStopped = {
.longPressDraggableHandle(onDragStopped = {
val changeItems = mutableListOf<SubsItem>()
orderSubItems.forEachIndexed { i, subsItem ->
if (subItems[i] != subsItem) {
@ -305,7 +305,9 @@ fun useSubsManagePage(): ScaffoldExt {
}
}
if (orderSubItems.isNotEmpty()) {
DbSet.subsItemDao.update(*changeItems.toTypedArray())
vm.viewModelScope.launchTry {
DbSet.subsItemDao.update(*changeItems.toTypedArray())
}
}
})
.shadow(elevation)