aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/UndoManager.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2021-02-25 15:36:49 -0500
committerusodhi <61431818+usodhi@users.noreply.github.com>2021-02-25 15:36:49 -0500
commit95451a2eb0871856b946fff8a14ca0c385af5f1b (patch)
tree90c18c68c4e077d63dd3286d527b243ac6cdc501 /src/client/util/UndoManager.ts
parent02bceed486ecb03b94c757ae669f69912f282cdd (diff)
parent17ee7f6f1f61a079ec79b71aebc65abfd72ec32a (diff)
merging
Diffstat (limited to 'src/client/util/UndoManager.ts')
-rw-r--r--src/client/util/UndoManager.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts
index 569ad8ab4..05fb9f378 100644
--- a/src/client/util/UndoManager.ts
+++ b/src/client/util/UndoManager.ts
@@ -148,12 +148,15 @@ export namespace UndoManager {
}
});
- export function ClearTempBatch() {
- tempEvents = undefined;
- }
export function RunInTempBatch<T>(fn: () => T) {
tempEvents = [];
- return runInAction(fn);
+ try {
+ const success = runInAction(fn);
+ if (!success) UndoManager.UndoTempBatch();
+ return success;
+ } finally {
+ tempEvents = undefined;
+ }
}
//TODO Make this return the return value
export function RunInBatch<T>(fn: () => T, batchName: string) {