Skip to content

Commit

Permalink
Legacy undo & v2 queues must be cleared on backend op
Browse files Browse the repository at this point in the history
Fixes #12007
  • Loading branch information
dae authored and mikehardy committed Aug 16, 2022
1 parent 06741b6 commit f84baf6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/libanki/ChangeManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ object ChangeManager {
* to notify change subscribers of the changes. */
suspend fun <T> undoableOp(handler: Any? = null, block: CollectionV16.() -> T): T {
return withCol {
this.newBackend.block()
val result = newBackend.block()
// any backend operation clears legacy undo and resets study queues if it
// succeeds
clearUndo()
reset()
result
}.also {
withContext(Dispatchers.Main) {
ChangeManager.notifySubscribers(it, handler)
Expand Down

0 comments on commit f84baf6

Please sign in to comment.