Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#SPILL error should recalculate on changes to result area (before: "Setting a null value in the ARRAYFORMULA expansion area does not update the NoSpaceForArrayResult error[Bug]") #1287

Open
IMSupperkaka opened this issue Jun 8, 2023 · 4 comments
Labels
Bug Something isn't working Impact: Medium

Comments

@IMSupperkaka
Copy link

Description

The following code does not run as expected

const hf = HyperFormula.buildEmpty({
  licenseKey: "gpl-v3"
});

// Add a new sheet and get its id.
const table1 = hf.addSheet("table1");

hf.setCellContents(
  {
    row: 0,
    col: 0,
    sheet: hf.getSheetId(table1)
  },
  [[1,2],['=ARRAYFORMULA(A1:B1 > 1)', 1]]
);

// When set null at B2 does not recompute formula cell
hf.setCellContents(
  {
    row: 1,
    col: 1,
    sheet: hf.getSheetId(table1)
  },
  [[null]]
);

Expected behavior is that A2 recaculate when set null at B2

Video or screenshots

No response

Demo

https://codesandbox.io/s/nostalgic-wozniak-imse6d?file=/src/index.js

HyperFormula version

2.4.0

Your framework

No response

Your environment

chrome 113

@adrianszymanski89
Copy link
Contributor

Hi @IMSupperkaka

After the initial investigation, it doesn't exactly look like a bug in the HyperFormula itself, as when I set the null value in the initial data, the formula calculates correctly.

However, I will need to check it with our developer, but he's currently on vacation and will be back by the end of the month. I'll update you once he is back.

@sequba
Copy link
Contributor

sequba commented Jun 22, 2023

@IMSupperkaka A formula cell recomputes only on updates to its dependencies. In your example, the cell A2 recomputes only when A1 or B1 changes. Unfortunately, #SPILL errors have no custom behavior in situations like that.

If you want to trigger recomputation manually you can use rebuildAndRecalculate method or simply setCellContents:

hf.rebuildAndRecalculate();
// OR
hf.setCellContents(addr, [[hf.getCellSerialized(addr)]]);

Does it solve your issue?

@IMSupperkaka
Copy link
Author

rebuildAndRecalculate may have a relatively large performance overhead, setCellContents should solve my problem, but this seems to be a bug, is there any plan to fix it?

Another problem is that the expression of the array formula is not quite the same as that of Excel. For example, in Excel, the Filter function will only report an error if there is something else in the filtered array result, but we will check the size of the original array for additional values.

@sequba
Copy link
Contributor

sequba commented Jun 27, 2023

@IMSupperkaka

this seems to be a bug, is there any plan to fix it?

Yes, I agree it is a bug. I'm adding it to our backlog.

Another problem is that the expression of the array formula is not quite the same as that of Excel. For example, in Excel, the Filter function will only report an error if there is something else in the filtered array result, but we will check the size of the original array for additional values.

It seems like a separate matter unrelated to this one, so please open a new issue and provide a demo.

@sequba sequba changed the title Setting a null value in the ARRAYFORMULA expansion area does not update the NoSpaceForArrayResult error[Bug]: #SPILL error should recalculate on changes to result area (before: "Setting a null value in the ARRAYFORMULA expansion area does not update the NoSpaceForArrayResult error[Bug]") Jun 27, 2023
@sequba sequba added Impact: Medium Bug Something isn't working labels Jun 27, 2023
@sequba sequba changed the title #SPILL error should recalculate on changes to result area (before: "Setting a null value in the ARRAYFORMULA expansion area does not update the NoSpaceForArrayResult error[Bug]") #SPILL error should recalculate on changes to result area (before: "Setting a null value in the ARRAYFORMULA expansion area does not update the NoSpaceForArrayResult error[Bug]") Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Impact: Medium
Projects
None yet
Development

No branches or pull requests

3 participants