diff --git a/package.json b/package.json index 69472c87..f0f3cb44 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/structs/AbstractItem.js b/src/structs/AbstractItem.js index ace332df..614fb4ef 100644 --- a/src/structs/AbstractItem.js +++ b/src/structs/AbstractItem.js @@ -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) diff --git a/tests/testHelper.js b/tests/testHelper.js index 54dd1172..3ea840da 100644 --- a/tests/testHelper.js +++ b/tests/testHelper.js @@ -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' diff --git a/tests/y-array.tests.js b/tests/y-array.tests.js index ec3d3f07..ffa595f8 100644 --- a/tests/y-array.tests.js +++ b/tests/y-array.tests.js @@ -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) } /**