aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-20 13:43:15 -0400
committerbobzel <zzzman@gmail.com>2020-10-20 13:43:15 -0400
commit52161a48a9d5f0732e6fe741a8a9a7c2b6dac49e (patch)
tree77c691e373c7309e7d434fe14a3b1d5134b2d90c /src/client
parent48e907bdf5424f53c03f60bd93122135e7c1cb92 (diff)
fixed concurrency problem when adding/deleting from lists in rapid succession. was causing presentation lists to do strange things when deleting multiple documents at once.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/views/nodes/PresBox.tsx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 01a7bed8c..677d612b6 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -710,14 +710,14 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
handled = true;
} if (e.keyCode === 8) { // delete selected items
if (this.layoutDoc.presStatus === "edit") {
- await Promise.all<boolean>(this._selectedArray.map((doc, i): boolean => {
- const removed: boolean = this.removeDocument(doc);
- console.log("Is removed? : " + i + " | " + removed);
- return removed;
- }));
- action(() => this._selectedArray = []);
- action(() => this._eleArray = []);
- action(() => this._dragArray = []);
+ runInAction(() => {
+ for (const doc of this._selectedArray) {
+ this.removeDocument(doc);
+ }
+ this._selectedArray = [];
+ this._eleArray = [];
+ this._dragArray = [];
+ });
handled = true;
}
} if (handled) {