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
  • Loading branch information
dae committed Aug 13, 2022
1 parent 435873f commit cccc948
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 cccc948

Please sign in to comment.