handsontable / handsontable/hyperformula
#CYCLE! shouldn't occur when the IF condition is not met
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.8k
- Forks
- 171
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 7
Description
Description
If we have an IF function where the conditions that lead to #CYCLE! error isn't met we will get an error anyway. All other spreadsheets I've checked, GS, XL, LC, handles this situation differently. When the condition for circular reference is met the GS will show #REF with a description about circular reference, XL will display a pop-up, LC will show Err:522 which is described as "522 Circular reference"[1].
HF will always return #CYCLE! error. Doesn't matter if the condision is met or not.
Steps to reproduce
This test should pass
it('circular dependency when the IF condition is not met', () => {
const engine = HyperFormula.buildFromArray([
['0', '=IF($A$1=0,0,B1)'],
['1', '=IF($A$2=0,0,B1)'],
])
expect(engine.getCellValue(adr('B1'))).toEqual(0)
expect(engine.getCellValue(adr('B1'))).toEqual(detailedError(ErrorType.CYCLE))
})
Links
[1] https://help.libreoffice.org/6.2/en-US/text/scalc/05/02140000.html
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 with the inline HyperFormula.buildFromArray reproduction and the handling of IF conditions, circular dependencies, and ErrorType.CYCLE. Verify the expected value for the provided case, then add or adjust a regression test so an unselected circular branch does not produce #CYCLE!, while a selected circular branch still does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100