Skip to content

Commit

Permalink
Add update rank for draft
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Brechka <anton.brechka@xored.com>
  • Loading branch information
Anton Brechka committed Apr 5, 2023
1 parent 1d8632c commit ef40466
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/presentation/src/components/DraggableList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
handleMove(draggingIndex, toIndex)
return
}
if (!checkHasRank(objects) || isDraft) {
if (!checkHasRank(objects)) {
return
}
const [prev, next] = [
Expand All @@ -76,7 +76,12 @@
]
const object = objects[draggingIndex]
await client.update(object, { rank: calcRank(prev, next) })
const newRank = calcRank(prev, next)
if (isDraft) {
object.rank = newRank
} else {
await client.update(object, { rank: newRank })
}
}
resetDrag()
}
Expand Down

0 comments on commit ef40466

Please sign in to comment.