reactgrid
reactgrid copied to clipboard
RowRenderer crashes when ScrollableRange is empty
Describe the bug When e.g. all columns of a table are marked as sticky, the scrollable range of the cell matrix can be empty. This causes RowRenderer to crash at https://github.com/silevis/reactgrid/blob/c981381f725982082fee38e6b17df70e56a60b90/src/lib/Components/RowRenderer.tsx#L42 Because cellMatrix.scrollableRange.last.column is undefined. Admittedly, this is an edge case, but it can happen in our application when the user unselects all non-mandatory columns.
Current behavior reactgrid crashes when the scrollable range is empty
Expected behavior I expect reactgrid not to crash
Are there any examples that can be run? Codepen?
pretty trivial, I have created a small repo: https://github.com/mithodin/reactgrid-undefined-range
Yes, all columns of a table are marked as sticky, the scrollable range of the cell matrix can be empty. Adding the optional chaining operator is usually aimed at accessing the properties of nested objects more safely and avoiding runtime errors that may be caused by the fact that the value of the "column" property might be undefined.