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(sheet): the range may be undefined (#4706)

VicKune480b80101be
diff --git a/packages/sheets-ui/src/controllers/auto-height.controller.ts b/packages/sheets-ui/src/controllers/auto-height.controller.ts
index 134b492102..c374e512c4 100644
--- a/packages/sheets-ui/src/controllers/auto-height.controller.ts
+++ b/packages/sheets-ui/src/controllers/auto-height.controller.ts
@@ -83,8 +83,9 @@ export class AutoHeightController extends Disposable {
const config = configService.getConfig<IUniverSheetsUIConfig>(SHEETS_UI_PLUGIN_CONFIG_KEY);
let rangeList = ranges;
if (!Array.isArray(ranges)) {
+ // TODO: @weird94 after we resolve the performance issue of auto hight, we can remove this code.
// The code "const params = command.params as ISetRangeValuesRangeMutationParams;" of _initialize() method may make IRange as IRange[]. so need adjust here.
- if ((ranges as IRange).startRow !== undefined && (ranges as IRange).startRow !== undefined) {
+ if (ranges && (ranges as IRange).startRow !== undefined && (ranges as IRange).startRow !== undefined) {
rangeList = [ranges];
} else {
rangeList = [];