Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheets): skip remove-sheet on watch range if skipIntersects was set (#3356)

zhangw2ee440aa6ef9
diff --git a/packages/sheets/src/services/ref-range/ref-range.service.ts b/packages/sheets/src/services/ref-range/ref-range.service.ts
index 126fb1c905..0caeb5499d 100644
--- a/packages/sheets/src/services/ref-range/ref-range.service.ts
+++ b/packages/sheets/src/services/ref-range/ref-range.service.ts
@@ -36,6 +36,7 @@ import { SheetInterceptorService } from '../sheet-interceptor/sheet-interceptor.
import type { ISheetCommandSharedParams } from '../../commands/utils/interface';
import type { IMoveRangeMutationParams } from '../../commands/mutations/move-range.mutation';
import { MoveRangeMutation } from '../../commands/mutations/move-range.mutation';
+import { RemoveSheetMutation } from '../../commands/mutations/remove-sheet.mutation';
import type { EffectRefRangeParams } from './type';
import { EffectRefRangId } from './type';
import { adjustRangeOnMutation, getEffectedRangesOnMutation } from './util';
@@ -84,9 +85,12 @@ class WatchRange extends Disposable {
}
if (this._skipIntersects) {
+ if (mutation.id === RemoveSheetMutation.id) {
+ return;
+ }
const effectRanges = getEffectedRangesOnMutation(mutation);
if (effectRanges?.some((effectRange) => Rectangle.intersects(effectRange, this._range!))) {
- return false;
+ return;
}
}