Delete all children of ItemType when it is deleted

This commit is contained in:
Kevin Jahns
2019-04-26 12:29:28 +02:00
parent 1d0f9faa91
commit 21d86cd2be
6 changed files with 44 additions and 25 deletions

View File

@@ -454,13 +454,10 @@ export const typeArrayDelete = (transaction, parent, index, length) => {
if (length === 0) { return }
let n = parent._start
// compute the first item to be deleted
for (; n !== null; n = n.right) {
for (; n !== null && index > 0; n = n.right) {
if (!n.deleted && n.countable) {
if (index <= n.length) {
if (index < n.length && index > 0) {
n = getItemCleanStart(transaction, transaction.y.store, createID(n.id.client, n.id.clock + index))
}
break
if (index < n.length) {
getItemCleanStart(transaction, transaction.y.store, createID(n.id.client, n.id.clock + index))
}
index -= n.length
}