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

`Error: useRowSelection must be used within DataGrid cells` bunping `7.0.0-beta.44` => `7.0.0-beta.47`

Open softmarshmallow opened this issue 1 year ago • 0 comments

I have this custom leading header column renderer, worked fine until .44, after bumping to .47, it no longer works with following error.

Error: useRowSelection must be used within DataGrid cells

Perhaps the contributor know what this is about?


export const SelectColumn: CalculatedColumn<any, any> = {
  key: "__gf_select",
  name: "",
  idx: 0,
  width: 65,
  maxWidth: 65,
  resizable: false,
  sortable: false,
  frozen: true,
  renderHeaderCell: (props: RenderHeaderCellProps<unknown>) => {
    // eslint-disable-next-line react-hooks/rules-of-hooks
    const [isRowSelected, onRowSelectionChange] = useRowSelection();

    return (
      <SelectCellHeader
        aria-label="Select All"
        tabIndex={props.tabIndex}
        value={isRowSelected}
        onChange={(checked) =>
          onRowSelectionChange({ type: "HEADER", checked })
        }
      />
    );
  },
....
Screenshot 2024-09-13 at 3 02 14 AM

softmarshmallow avatar Sep 12 '24 18:09 softmarshmallow