handsontable / handsontable/hyperformula
Inline arrays don't watch their dependencies (previously: Volatile formulas not recalculating array dependencies)
Open
Nobody has claimed this yet.
Feature
Impact: Medium
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
This is quite a big bug I think as the root cause of it is arrays are not being processed in the dependencies. This means that there are likely other bugs caused by this.
The following unit test fails when it should pass.
volatile-functions.spec.ts
it('array cell which is dependent on volatile formula is also recomputed', () => {
const engine = HyperFormula.buildFromArray([
['=RAND()', '42', '={A1}'],
])
const valueBeforeRecomputation = engine.getCellValue(adr('C1'))
engine.setCellContents(adr('B1'), '35')
expect(engine.getCellValue(adr('C1'))).not.toEqual(valueBeforeRecomputation)
})
Fix:
collectDependencies.ts
case AstNodeType.ARRAY: {
ast.args.forEach((arrArg: Ast[]) => {
arrArg.forEach((ast) =>
collectDependenciesFn(ast, functionRegistry, dependenciesSet, needArgument)
)
})
return
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in collectDependencies.ts and review the failing case in volatile-functions.spec.ts. Run that test to confirm the current behavior; done means the array cell dependent on the volatile formula is recomputed after B1 changes and the test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100