hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

Calling `setRowsOrder` twice crashes the application

Open sequba opened this issue 1 year ago • 2 comments

Description

A call to setRowsOrder might modify sheet dimensions. It is counterintuitive and unexpected. image

Demo

https://codesandbox.io/s/funny-https-h9go7f?file=/src/hyperformulaConfig.js

Links

https://github.com/handsontable/dev-handsontable/issues/440#issuecomment-1455673440 https://handsoncode.slack.com/archives/C04MC750UJW/p1678191576051399 (internal, private channel)

sequba avatar Mar 07 '23 14:03 sequba

An idea for the solution:

setRowsOrder requires its argument to be the same length as the height of the sheet. But the sheet dimensions are potentially infinite. We might modify setRowsOrder method to operate on first N rows, where N is the length of the permutation provided as an argument to setRowsOrder.

Note: setColumnOrder needs to be modified accordingly.

sequba avatar Mar 07 '23 14:03 sequba

Its worth to simplify (remove?) below code after resolving the change.

https://github.com/handsontable/handsontable/blob/299e4e77f9842686a878c69252feb9bd07b0134e/handsontable/src/plugins/formulas/indexSyncer/axisSyncer.js#L337-L354

wszymanski avatar Mar 09 '23 12:03 wszymanski