Skip to content

[Bug] VuiTable onSelectRow is buggy when idField is a callback #254

@cjcenizal

Description

@cjcenizal

Bug Description
When VuiTable has idField defined as a callback and selection.onSelectRow prop is in use, selecting a row in such case results in a crash of VuiTable component.

For example, the following code results in the below error (see screenshot), even though all rows have corpusInfo.key field defined.

<VuiTable
      idField={(item) => item.corpusInfo.key}
      columns={columns}
      rows={corporaStatesArr}
      selection={{
        bulkActions: [
          {
            label: "Clear selected",
            onClick: (toClear) => {
              console.log("Clear selected", toClear);
            }
          }
        ],
        onSelectRow: (selectedRows) => {
          setSelectedCorpura(selectedRows);
        },
        selectedRows: selectedCorpora
      }}
    />
Image

Note
This issue doesn't occur in the following cases:

  1. idField is a string
  2. idField is a callback and rows data items have an id field

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions