Browse Source

feat: undo/redo skip failed

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5332/head
mertmit 2 years ago
parent
commit
89014166b9
  1. 16
      packages/nc-gui/composables/useUndoRedo.ts

16
packages/nc-gui/composables/useUndoRedo.ts

@ -62,8 +62,12 @@ export const useUndoRedo = createSharedComposable(() => {
const action = undoQueue.value.splice(actionIndex, 1)[0]
if (action) {
await action.undo.fn.apply(action, action.undo.args)
addRedo(action)
try {
await action.undo.fn.apply(action, action.undo.args)
addRedo(action)
} catch (e) {
message.warn('Error while undoing action, it is skipped.')
}
}
}
@ -87,8 +91,12 @@ export const useUndoRedo = createSharedComposable(() => {
const action = redoQueue.value.splice(actionIndex, 1)[0]
if (action) {
await action.redo.fn.apply(action, action.redo.args)
addUndo(action)
try {
await action.redo.fn.apply(action, action.redo.args)
addUndo(action)
} catch (e) {
message.warn('Error while redoing action, it is skipped.')
}
}
}

Loading…
Cancel
Save