adazzle / react-data-grid

Feature-rich and customizable data grid React component
https://adazzle.github.io/react-data-grid/
Other
6.93k stars 2.18k forks source link

Cannot read properties of undefined (reading 'parent') #3483

Open paustint opened 6 months ago

paustint commented 6 months ago

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

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.