diff options
author | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-05-04 10:38:40 -0400 |
---|---|---|
committer | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-05-04 10:38:40 -0400 |
commit | 0c25989104bef9785bf112490c73541bd4bc1764 (patch) | |
tree | b0ced46668e67faa3effb11190505bd4a1fa67e6 /src/fields/List.ts | |
parent | 725bf38dc018cb218d8a88605234e95a2beee446 (diff) |
First attempt at remfromlsit
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 9c7794813..eb735dec2 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); + // console.log(hintArray); + // console.log(list.__fields); this[Update]( items.length === 0 && deleteCount - ? { op: '$remFromSet', items: removed, length: list.__fields.length } + ? { op: '$remFromSet', items: removed, hint : { start : start, deleteCount : deleteCount, hintArray : hintArray}, length: list.__fields.length } : items.length && !deleteCount && start === list.__fields.length ? { op: '$addToSet', items, length: list.__fields.length } : undefined |