react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

Cannot read properties of undefined (reading 'parent')

Open paustint opened this issue 1 year ago • 0 comments

Describe the bug

I have been getting occasional errors logged to my bug tracker for an exception from react-data-grid, but I have been unable to reproduce the issue no matter what I have tried.

Keyboard navigation works for me in every complex case I can figure out.

Cannot read properties of undefined (reading 'parent')
TypeError: Cannot read properties of undefined (reading 'parent')
  File "../../../node_modules/react-data-grid/lib/bundle.js", line 227, in n$e
        let parent = nextColumn.parent;
  File "../../../node_modules/react-data-grid/lib/bundle.js", line 2531, in Gt
        const nextSelectedCellPosition = getNextSelectedCellPosition({
  File "../../../node_modules/react-data-grid/lib/bundle.js", line 2278, in vr
            navigate(event);
// src/utils/selectedCellUtils.ts

if (nextRowIdx < mainHeaderRowIdx) {
  const nextColumn = columns[nextIdx]; // This appears to return undefined
  let parent = nextColumn.parent; // error happens here
...
}
  1. Do you have any idea on what might be causing this?
  2. Would it be possible to defend against this exception by making sure that nextColumn is not undefined?

Environment

  • react-data-grid version: 7.0.0-beta.41
  • react/react-dom version: 18.2.0

All errors from bug tracker have been on Chrome and have happened on both windows and OSX, so I don't think is is OS related.

paustint avatar Apr 06 '24 17:04 paustint