hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

Error `Value of the formula cell is not computed` after call to `addNamedExpression` and `updateConfig`

Open sequba opened this issue 2 years ago • 3 comments

Description

Needs investigation

const hf = HyperFormula.buildFromArray([[1, 2, "=A1+B1"]], {
  licenseKey: "gpl-v3"
});

const sheetName = "Sheet1";
const sheetId = hf.getSheetId(sheetName);

hf.addNamedExpression("ABC", "=SUM(Sheet1!$A$1:Sheet1!$C$1)");
hf.updateConfig({ maxRows: 100 });

Demo

https://codesandbox.io/s/sad-butterfly-nskjc2?file=/src/hyperformulaConfig.js:145-403

Links

https://github.com/handsontable/hyperformula/issues/444

sequba avatar Mar 16 '23 18:03 sequba

@sequba Ran into a similar issue with batching cells with the same address when evaluation is suspended:

https://codesandbox.io/s/young-butterfly-zdxrvc?file=/src/hyperformulaConfig.js

import HyperFormula from "hyperformula";

console.log(
  `%c Using HyperFormula ${HyperFormula.version}`,
  "color: blue; font-weight: bold"
);

const hf = HyperFormula.buildFromArray([[1, 2, "=A1+B1"]], {
  licenseKey: "gpl-v3"
});

const sheetName = "Sheet1";
const sheetId = hf.getSheetId(sheetName);

hf.suspendEvaluation();
hf.setCellContents({ sheet: sheetId, row: 0, col: 2 }, "=A1/B2");
hf.setCellContents({ sheet: sheetId, row: 0, col: 2 }, "10");
hf.resumeEvaluation();

export { hf, sheetName, sheetId };

BrianHung avatar May 09 '23 21:05 BrianHung

Thank you for sharing the issue report @BrianHung

I see that the demo throws the following error (tested on Chrome 113)

Error: Value of the formula cell is not computed.
    at FormulaCellVertex.getCellValue (FormulaCellVertex.js:172:13)
    at AddressMapping.getCellValue (AddressMapping.js:57:21)
    at DependencyGraph.getCellValue (DependencyGraph.js:522:32)
    at Operations.setFormulaToCell (Operations.js:474:43)
    at Operations.setCellContent (Operations.js:443:14)
    at CrudOperations.setCellContents (CrudOperations.js:182:44)
    at HyperFormula.setCellContents (HyperFormula.js:263:26)
    at $csb$eval (hyperformulaConfig.js:17:4)
    at H (eval.js:31:28)
    at K.evaluate (transpiled-module.js:715:29)
    at ge.evaluateTranspiledModule (manager.js:340:33)
    at c (transpiled-module.js:697:31)
    at $csb$eval (renderers.js:1:1)
    at H (eval.js:31:28)
    at K.evaluate (transpiled-module.js:715:29)
    at ge.evaluateTranspiledModule (manager.js:340:33)
    at c (transpiled-module.js:697:31)
    at $csb$eval (index.js:1:1)
    at H (eval.js:31:28)
    at K.evaluate (transpiled-module.js:715:29)
    at ge.evaluateTranspiledModule (manager.js:340:33)
    at c (transpiled-module.js:697:31)
    at loadResources (index.html:5:2)
    at $csb$eval (index.html:11:3)
    at H (eval.js:31:28)
    at K.evaluate (transpiled-module.js:715:29)
    at ge.evaluateTranspiledModule (manager.js:340:33)
    at ge.evaluateModule (manager.js:311:34)
    at compile.ts:833:31
    at c (runtime.js:45:40)
    at Generator._invoke (runtime.js:274:22)
    at forEach.t.<computed> [as next] (runtime.js:97:21)
    at e (asyncToGenerator.js:3:20)
    at a (asyncToGenerator.js:25:9)

even when I change 10 to =10 that line seems to be the issue. First value attachment does not cause the error.

AMBudnik avatar May 12 '23 12:05 AMBudnik