diff options
author | bobzel <zzzman@gmail.com> | 2023-05-10 10:12:54 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-05-10 10:12:54 -0400 |
commit | bbdefbe2ed56348ceafd83f34d02cc649b84e269 (patch) | |
tree | 5d3755a381c5b66c991b6746919d39fc78cd03bd /src/fields/List.ts | |
parent | ebb846116af9c7e65a9d674c765c71c0bf0a7d29 (diff) | |
parent | 97a743455e7fa3eee768b1d4d025b9dedc49f370 (diff) |
Merge branch 'master' into UI_Update_Eric_Ma
Diffstat (limited to 'src/fields/List.ts')
-rw-r--r-- | src/fields/List.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fields/List.ts b/src/fields/List.ts index e33627be5..dfd24cf7a 100644 --- a/src/fields/List.ts +++ b/src/fields/List.ts @@ -77,10 +77,16 @@ const listHandlers: any = { item[OnUpdate] = updateFunction(list, i + start, item, this); } } + let hintArray: {val : any, index : number}[] = []; + for(let i = start; i < start + deleteCount; i++) { + hintArray.push({val : list.__fields[i], index : i}); + } const res = list.__fields.splice(start, deleteCount, ...items); + // the hint object sends the starting index of the slice and the number + // of elements to delete. this[Update]( items.length === 0 && deleteCount - ? { op: '$remFromSet', items: removed, length: list.__fields.length } + ? { op: '$remFromSet', items: removed, hint : { start : start, deleteCount : deleteCount }, length: list.__fields.length } : items.length && !deleteCount && start === list.__fields.length ? { op: '$addToSet', items, length: list.__fields.length } : undefined |