Fix linting

This commit is contained in:
Chen-I Lim 2020-11-12 15:48:31 -08:00
parent c942c43ea7
commit d4d0f5c42d
2 changed files with 21 additions and 9 deletions

View file

@ -98,9 +98,11 @@ class Mutator {
},
async () => {
await beforeUndo?.()
const awaits = []
for (const block of blocks) {
await octoClient.deleteBlock(block.id)
awaits.push(octoClient.deleteBlock(block.id))
}
await Promise.all(awaits)
},
description,
this.undoGroupId,

View file

@ -128,11 +128,16 @@ class UndoManager {
}
const currentGroupId = command.groupId
do {
if (currentGroupId) {
do {
// eslint-disable-next-line no-await-in-loop
await this.execute(command, 'undo')
this.index -= 1
command = this.commands[this.index]
} while (this.index >= 0 && currentGroupId === command.groupId)
} else {
await this.execute(command, 'undo')
this.index -= 1
command = this.commands[this.index]
} while (this.index >= 0 && currentGroupId && currentGroupId === command.groupId)
}
if (this.onStateDidChange) {
this.onStateDidChange()
@ -151,11 +156,16 @@ class UndoManager {
}
const currentGroupId = command.groupId
do {
if (currentGroupId) {
do {
// eslint-disable-next-line no-await-in-loop
await this.execute(command, 'redo')
this.index += 1
command = this.commands[this.index + 1]
} while (this.index < this.commands.length - 1 && currentGroupId === command.groupId)
} else {
await this.execute(command, 'redo')
this.index += 1
command = this.commands[this.index + 1]
} while (this.index < this.commands.length - 1 && currentGroupId && currentGroupId === command.groupId)
}
if (this.onStateDidChange) {
this.onStateDidChange()