`#REF!` error after adding new sheet
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
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.
Thank you for the feedback @adjenks
This issue is still open, but we will notify you once it's fixed and released.