aboutsummaryrefslogtreecommitdiff
path: root/src/fields
diff options
context:
space:
mode:
authorljungster <parkerljung@gmail.com>2022-08-22 15:53:13 -0400
committerljungster <parkerljung@gmail.com>2022-08-22 15:53:13 -0400
commit92cd2f5655c428252c8dc20df06bea024c43e2dc (patch)
tree6383fd8e1d5f2aa78f37553772f00ba072ce3a65 /src/fields
parent7f4f2840cd64c1eb40851c2ee410fa1905288b73 (diff)
parent007cc5159e3e624352bdb686c82b11d1173a5ad7 (diff)
Merge branch 'parker' of https://github.com/brown-dash/Dash-Web into parker
Diffstat (limited to 'src/fields')
-rw-r--r--src/fields/util.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fields/util.ts b/src/fields/util.ts
index d87bb6656..b3cbbe241 100644
--- a/src/fields/util.ts
+++ b/src/fields/util.ts
@@ -445,8 +445,13 @@ export function updateFunction(target: any, prop: any, value: any, receiver: any
undo: action(() => {
// console.log("undo $add: " + prop, diff.items) // bcz: uncomment to log undo
diff.items.forEach((item: any) => {
- const ind = receiver[prop].indexOf(item.value ? item.value() : item);
- ind !== -1 && receiver[prop].splice(ind, 1);
+ if (item instanceof SchemaHeaderField) {
+ const ind = receiver[prop].findIndex((ele: any) => ele instanceof SchemaHeaderField && ele.heading === item.heading);
+ ind !== -1 && receiver[prop].splice(ind, 1);
+ } else {
+ const ind = receiver[prop].indexOf(item.value ? item.value() : item);
+ ind !== -1 && receiver[prop].splice(ind, 1);
+ }
});
lastValue = ObjectField.MakeCopy(receiver[prop]);
}),