mirror of
https://github.com/cudr/slate-collaborative.git
synced 2024-10-27 20:34:06 +00:00
Fix set wrong map value for list remove item op.
This commit is contained in:
parent
e7648b083d
commit
16cf59536f
@ -55,18 +55,16 @@ const removeNodeOp = (op: Automerge.Diff) => (map: any, doc: Element) => {
|
||||
throw new TypeError('Target is not found!')
|
||||
}
|
||||
|
||||
if (!map.hasOwnProperty(obj)) {
|
||||
map[obj] = target
|
||||
}
|
||||
|
||||
if (!Number.isInteger(index)) {
|
||||
throw new TypeError('Index is not a number')
|
||||
}
|
||||
|
||||
if (parent?.children?.[index as number]) {
|
||||
parent.children.splice(index, 1)
|
||||
map[obj] = parent?.children
|
||||
} else if (parent?.[index as number]) {
|
||||
parent.splice(index, 1)
|
||||
map[obj] = parent
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user