fix: removeNodeOp throwing an error

This commit is contained in:
Eric Maciel 2020-10-27 18:29:50 -04:00
parent bb04f2d81c
commit c4eb8578f1

View File

@ -41,7 +41,7 @@ const removeNodeOp = ({ index, obj, path }: Automerge.Diff) => (
const slatePath = toSlatePath(path) const slatePath = toSlatePath(path)
const parent = getTarget(doc, slatePath) const parent = getTarget(doc, slatePath)
const target = parent?.children[index as number] || { children: [] } const target = parent?.children?.[index as number] || { children: [] }
if (!map.hasOwnProperty(obj)) { if (!map.hasOwnProperty(obj)) {
map[obj] = target map[obj] = target