hyperformula
hyperformula copied to clipboard
Calling `setRowsOrder` twice crashes the application
Description
A call to setRowsOrder
might modify sheet dimensions. It is counterintuitive and unexpected.
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)
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.
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