From e41152b169a941238bfc257a4ec6324a8fb088f9 Mon Sep 17 00:00:00 2001 From: Yann Achard Date: Tue, 5 Sep 2023 16:47:55 -0700 Subject: [PATCH] Less inval of dependents --- .../chunked-forest/chunkedForest.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/experimental/dds/tree2/src/feature-libraries/chunked-forest/chunkedForest.ts b/experimental/dds/tree2/src/feature-libraries/chunked-forest/chunkedForest.ts index ec0da508706c..77b0133731f5 100644 --- a/experimental/dds/tree2/src/feature-libraries/chunked-forest/chunkedForest.ts +++ b/experimental/dds/tree2/src/feature-libraries/chunked-forest/chunkedForest.ts @@ -110,8 +110,14 @@ class ChunkedForest extends SimpleDependee implements IEditableForest { ); return this.mutableChunkStack[this.mutableChunkStack.length - 1]; }, - moveIn(index: number, toAttach: DetachedField): number { - this.forest.invalidateDependents(); + moveIn( + index: number, + toAttach: DetachedField, + invalidateDependents: boolean = true, + ): number { + if (invalidateDependents) { + this.forest.invalidateDependents(); + } const detachedKey = detachedFieldAsKey(toAttach); const children = this.forest.roots.fields.get(detachedKey) ?? []; this.forest.roots.fields.delete(detachedKey); @@ -144,7 +150,7 @@ class ChunkedForest extends SimpleDependee implements IEditableForest { const chunks: TreeChunk[] = content.map((c) => chunkTree(c, this.forest.chunker)); const field = this.forest.newDetachedField(); this.forest.roots.fields.set(detachedFieldAsKey(field), chunks); - this.moveIn(index, field); + this.moveIn(index, field, false); }, onMoveOut(index: number, count: number, id?: Delta.MoveId): void { this.forest.invalidateDependents();