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

[Bug]: Missing exported changes when batching operations #1291

Closed
BrianHung opened this issue Jul 19, 2023 · 5 comments · Fixed by #1294
Closed

[Bug]: Missing exported changes when batching operations #1291

BrianHung opened this issue Jul 19, 2023 · 5 comments · Fixed by #1294
Labels
Bug Something isn't working Impact: Medium Released

Comments

@BrianHung
Copy link
Contributor

BrianHung commented Jul 19, 2023

Description

When batching an array formula along with neighboring cell values, change values for neighboring cells are not emitted in valuesUpdated or in exported changes when resuming evaluation. Note that values are correctly in hyperformula though (getSheetSerialized is correct).

That means, if we batch an array with a column formula with cells in the same row, none of the cells in the same row will be emitted.

Likewise, if we batch an array with a row formula with cells in the same col, none of the cells in the same col will be emitted.

Batching an array with multiple rows and columns works though.

import HyperFormula from "hyperformula";

const hf = HyperFormula.buildFromSheets(
  {
    Sheet1: [[""]]
  },
  {
    licenseKey: "gpl-v3",
    useArrayArithmetic: true
  }
);

hf.on("valuesUpdated", (changes) => console.log("changes", changes));

const changes = [];
hf.suspendEvaluation();
changes.push(hf.setCellContents({ sheet: 0, row: 0, col: 1 }, "4"));
changes.push(hf.setCellContents({ sheet: 0, row: 0, col: 2 }, "5"));
changes.push(hf.setCellContents({ sheet: 0, row: 0, col: 0 }, "={1;2;3}"));
hf.resumeEvaluation();

console.log("changes after evaluation", changes);

Code sandbox showing it doesnt work row for adjacent col values if array row formula.
https://codesandbox.io/s/angry-pond-tmy9fq?file=/src/hyperformulaConfig.js

Code sandbox showing it doesnt work for adjacent row values if array col formula.
https://codesandbox.io/s/bold-dawn-w8383q?file=/src/hyperformulaConfig.js

Video or screenshots

No response

Demo

https://codesandbox.io/s/angry-pond-tmy9fq?file=/src/hyperformulaConfig.js

HyperFormula version

2.4.0

Your framework

No response

Your environment

Chrome

@BrianHung BrianHung changed the title [Bug]: Missing Changes in valuesUpdated When Batching Array Formula [Bug]: Missing Exported Changes When Batching Array Formula Jul 19, 2023
@adrianszymanski89
Copy link
Contributor

Hi @BrianHung

Thank you for reporting this. I also test it in various scenarios, and I can confirm your observations. I'll forward this to our HyperFormula developer for further investigation.

@BrianHung
Copy link
Contributor Author

BrianHung commented Jul 31, 2023

@adrianszymanski89 Think I found the bug and implemented a fix: #1294

By the looks of it, it was a 2 year old bug where the author was refactoring code and forgot to use a new internal utility addressKey when writing new code.

@adrianszymanski89
Copy link
Contributor

Hi @BrianHung

Thank you for the fix! I'll update our developer about the PR.

@sequba sequba changed the title [Bug]: Missing Exported Changes When Batching Array Formula [Bug]: Missing exported changes when batching operations Aug 2, 2023
@AMBudnik
Copy link
Contributor

I've tested the following demo with Hyperformula 2.5.0 and the build from release branch 2.6.0 and all of the changes are correctly logged in the new version

Hyperformula 2.5.0
Zrzut ekranu 2023-09-14 o 14 03 23

Hyperformula 2.6.0
Zrzut ekranu 2023-09-14 o 14 03 15

@AMBudnik
Copy link
Contributor

Hi @BrianHung

We have an update here as well. I hope you'll benefit from those changes.

ps. If you'd like to know what also changed in the version here are our release notes https://hyperformula.handsontable.com/guide/release-notes.html#_2-6-0

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 Released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants