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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(formula): write snapshot error (#6118)
Univer4bb32b46b767
diff --git a/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts b/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.tsindex d439fadfca..4057dbe45c 100644--- a/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts+++ b/packages/sheets-formula/src/controllers/array-formula-cell-interceptor.controller.ts@@ -131,7 +131,7 @@ export class ArrayFormulaCellInterceptorController extends Disposable {private _writeArrayFormulaToSnapshot(arrayFormulaRange: IArrayFormulaRangeType, arrayFormulaCellData: IArrayFormulaUnitCellType, arrayFormulaEmbedded: IArrayFormulaEmbeddedMap) {// Write values to the `ref` property of the array formula range.- Object.entries(arrayFormulaRange).forEach(([unitId, subUnitData]) => {+ arrayFormulaRange && Object.entries(arrayFormulaRange).forEach(([unitId, subUnitData]) => {subUnitData && Array.from(Object.entries(subUnitData)).forEach(([subUnitId, rangeData]) => {// Convert from IObjectMatrixPrimitiveType<IRange> to IObjectMatrixPrimitiveType<ICellData>const cellValue = new ObjectMatrix<ICellData>();@@ -153,7 +153,7 @@ export class ArrayFormulaCellInterceptorController extends Disposable {});// <f t="array" ref="E7">SUM(A1:A7*B1:B7)</f> , write ref for embedded array formula cells- Array.from(Object.entries(arrayFormulaEmbedded)).forEach(([unitId, subUnitData]) => {+ arrayFormulaEmbedded && Object.entries(arrayFormulaEmbedded).forEach(([unitId, subUnitData]) => {subUnitData && Array.from(Object.entries(subUnitData)).forEach(([subUnitId, rangeData]) => {const cellValue = new ObjectMatrix<ICellData>();const matrix = new ObjectMatrix(rangeData);@@ -185,7 +185,7 @@ export class ArrayFormulaCellInterceptorController extends Disposable {});// Write values to the 'v' property of the cell data.- Array.from(Object.entries(arrayFormulaCellData)).forEach(([unitId, subUnitData]) => {+ arrayFormulaCellData && Object.entries(arrayFormulaCellData).forEach(([unitId, subUnitData]) => {subUnitData && Array.from(Object.entries(subUnitData)).forEach(([subUnitId, rowData]) => {// Keep this local to avoid triggering re-calculate in the worker.this._commandService.executeCommand<ISetRangeValuesMutationParams>(SetRangeValuesMutation.id, {