Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/plugins/ui_core_views/cell_evaluation/evaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ export class Evaluator {
private invalidatePositionsDependingOnSpread(sheetId: UID, resultZone: Zone) {
// the result matrix is split in 2 zones to exclude the array formula position
const invalidatedPositions = this.formulaDependencies().getCellsDependingOn(
excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone }))
excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone })),
this.nextPositionsToUpdate
);
invalidatedPositions.delete({ sheetId, col: resultZone.left, row: resultZone.top });
this.nextPositionsToUpdate.addMany(invalidatedPositions);
Expand Down Expand Up @@ -564,7 +565,7 @@ export class Evaluator {
for (const sheetId in zonesBySheetIds) {
ranges.push(...zonesBySheetIds[sheetId].map((zone) => ({ sheetId, zone })));
}
return this.formulaDependencies().getCellsDependingOn(ranges);
return this.formulaDependencies().getCellsDependingOn(ranges, this.nextPositionsToUpdate);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class FormulaDependencyGraph {
* in the correct order they should be evaluated.
* This is called a topological ordering (excluding cycles)
*/
getCellsDependingOn(ranges: RTreeBoundingBox[]): PositionSet {
getCellsDependingOn(ranges: RTreeBoundingBox[], ignore: PositionSet): PositionSet {
const visited = this.createEmptyPositionSet();
const queue: RTreeBoundingBox[] = Array.from(ranges).reverse();
while (queue.length > 0) {
Expand All @@ -74,7 +74,7 @@ export class FormulaDependencyGraph {
const impactedPositions = this.rTree.search(range).map((dep) => dep.data);
const nextInQueue: Record<UID, Zone[]> = {};
for (const position of impactedPositions) {
if (!visited.has(position)) {
if (!visited.has(position) && !ignore.has(position)) {
if (!nextInQueue[position.sheetId]) {
nextInQueue[position.sheetId] = [];
}
Expand Down