update parent._map when splitting an item

This commit is contained in:
Kevin Jahns 2019-04-26 19:45:37 +02:00
parent 8c5a06bbf8
commit 32c4c09072
4 changed files with 11 additions and 6 deletions

View File

@ -14,7 +14,7 @@
"lint": "standard && tsc",
"docs": "rm -rf docs; jsdoc --configure ./.jsdoc.json --verbose --readme ./README.v13.md --package ./package.json || true",
"serve-docs": "npm run docs && serve ./docs/",
"preversion": "PRODUCTION=1 npm run dist && node ./dist/tests.js --repitition-time 10000",
"preversion": "PRODUCTION=1 npm run dist && node ./dist/tests.js --repitition-time 1000",
"postversion": "git push && git push --tags",
"debug": "concurrently 'live-server --port=3443 --entry-file=test.html' 'npm run watch'",
"trace-deopt": "clear && rollup -c && node --trace-deopt dist/test.js",

View File

@ -76,6 +76,10 @@ export const splitItem = (transaction, leftItem, diff) => {
}
// right is more specific.
transaction._mergeStructs.add(rightItem.id)
// update parent._map
if (rightItem.parentSub !== null && rightItem.right === null) {
rightItem.parent._map.set(rightItem.parentSub, rightItem)
}
return rightItem
}
@ -426,7 +430,7 @@ export class AbstractItem extends AbstractStruct {
* @private
*/
gc (transaction, store, parentGCd) {
this.delete(transaction)
this.delete(transaction) // @todo: shouldn't be necessary
let r
if (parentGCd) {
r = new GC(this.id, this.length)
@ -612,7 +616,9 @@ export const computeItemParams = (transaction, store, leftid, rightid, parentid,
case GC:
break
default:
parent = parentItem.type
if (!parentItem.deleted) {
parent = parentItem.type
}
}
} else if (parentYKey !== null) {
parent = transaction.y.get(parentYKey)

View File

@ -9,7 +9,6 @@ import {
import * as t from 'lib0/testing.js'
import * as prng from 'lib0/prng.js'
import { createMutex } from 'lib0/mutex.js'
import * as encoding from 'lib0/encoding.js'
import * as decoding from 'lib0/decoding.js'
import * as syncProtocol from 'y-protocols/sync.js'

View File

@ -335,8 +335,8 @@ const arrayTransactions = [
/**
* @param {t.TestCase} tc
*/
export const testRepeatGeneratingYarrayTests20 = tc => {
applyRandomTests(tc, arrayTransactions, 3)
export const testRepeatGeneratingYarrayTests4 = tc => {
applyRandomTests(tc, arrayTransactions, 4)
}
/**