Skip to content

Commit

Permalink
Less inval of dependents
Browse files Browse the repository at this point in the history
  • Loading branch information
yann-achard-MS committed Sep 5, 2023
1 parent 66128ad commit e41152b
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e41152b

Please sign in to comment.