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: fix edit cell with remove sheet (#3474)

ybzky38b03fb0f9f1
diff --git a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
index bd76b959f1..73f96a9788 100644
--- a/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
+++ b/packages/sheets-ui/src/controllers/editor/editing.render-controller.ts
@@ -859,6 +859,13 @@ export class EditingRenderController extends Disposable implements IRenderModule
let worksheet = workbook.getActiveSheet();
const workbookId = this._context.unitId;
const worksheetId = worksheet.getSheetId();
+
+ // If the target cell does not exist, there is no need to execute setRangeValue
+ const setRangeValueTargetSheet = workbook.getSheetBySheetId(sheetId);
+ if (!setRangeValueTargetSheet) {
+ return;
+ }
+
// Reselect the current selections, when exist cell editor by press ESC.I
if (keycode === KeyCode.ESC) {
const selections = this._workbookSelections.getCurrentSelections();