fix: Add optional chaining for getSelectedRows in TableComponent (#5805)

🐛 (tableComponent/index.tsx): fix potential null pointer exception when getting selected rows length
This commit is contained in:
Cristhian Zanforlin Lousa 2025-01-20 13:14:45 -03:00 committed by GitHub
commit 00deb49c67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -223,7 +223,7 @@ const TableComponent = forwardRef<
<TableOptions
tableOptions={props.tableOptions}
stateChange={columnStateChange}
hasSelection={realRef.current?.api?.getSelectedRows().length > 0}
hasSelection={realRef.current?.api?.getSelectedRows()?.length > 0}
duplicateRow={props.onDuplicate ? props.onDuplicate : undefined}
deleteRow={props.onDelete ? props.onDelete : undefined}
addRow={props.addRow ? props.addRow : undefined}