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

Error encountered when decreasing the number of columns using a filter

Open Jialecl opened this issue 1 year ago • 0 comments

Describe the bug

I am not sure that my approach is the correct one, but I tried to add a select that works as a filter for the visible columns. Whenever the number of columns is reduced I get this error:

image

image

It seems that the issue is caused by an undefined column added to rawColumns2:

image

To Reproduce

  1. I filtered the columns before passing them as a prop to the data grid based on the values of a multiple select input
  2. By default all options are selected and unselecting any option to filter out the column from the ones passed to the data grid causes this error.
let expectedColumns = columns
  .filter((column) => visibleColumns.includes(column.name))
  .map((column) => {
    return (column);
});

Expected behavior

The rawColumn should be ignored if undefined.

Environment

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

Jialecl avatar Jun 17 '24 10:06 Jialecl