diff options
author | mehekj <mehek.jethani@gmail.com> | 2022-08-24 18:36:26 -0400 |
---|---|---|
committer | mehekj <mehek.jethani@gmail.com> | 2022-08-24 18:36:26 -0400 |
commit | b8ebc0f758d2240af29640d6f8dc490705b42bb9 (patch) | |
tree | 5bea5060ac3ed71dcd8a8197fbb7d0fbcf1677a2 /src/fields/util.ts | |
parent | e60323cb8c59823571c0c91069518145cb3fb6a1 (diff) | |
parent | 4658ad7e110ce8a68cc3ecf3693725270b8ca7a4 (diff) |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web
Diffstat (limited to 'src/fields/util.ts')
-rw-r--r-- | src/fields/util.ts | 9 |
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]); }), |