hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

`#REF!` error after adding new sheet

Open sequba opened this issue 3 years ago • 2 comments

Description

The dependency graph needs to be rebuilt sometime between adding new sheet and reading the cell that references it (lazily if possible). The mechanism might be analogous to what happens when new named expression is added.

Also:

  • test other methods (e.g. removeSheet) to make sure they also trigger the dependency graph rebuilding.
  • keep performance in mind!!!

Demo

https://codesandbox.io/s/loving-dijkstra-25ett6

Links

https://github.com/handsontable/hyperformula/issues/1114 #207 https://github.com/handsontable/hyperformula/issues/493

sequba avatar Dec 01 '22 17:12 sequba

Thank you. I was getting #REF! errors when referencing other sheets when calling getSheetValues(), but when referencing the same cells with getCellValue() it worked fine. I couldn't figure out what was going on. Calling rebuildAndRecalculate() seemed to solve the problem. I thought that everything was always recalculated unless it was turned off because the docs say "By default, HyperFormula recalculates formulas after every change." (https://hyperformula.handsontable.com/guide/performance.html#suspending-automatic-recalculations) . So I would agree that this is a bug, and calling rebuildAndRecalculate() before fetching sheet values is a temporary workaround.

adjenks avatar Mar 12 '25 21:03 adjenks

Thank you for the feedback @adjenks

This issue is still open, but we will notify you once it's fixed and released.

AMBudnik avatar Mar 13 '25 07:03 AMBudnik