mirror of
https://github.com/ansible/awx.git
synced 2026-03-08 21:19:26 -02:30
make sortColumnKey error message more clear
This commit is contained in:
committed by
John Mitchell
parent
f15325aebf
commit
495b4142c7
@@ -102,9 +102,16 @@ class Sort extends React.Component {
|
||||
const { up } = DropdownPosition;
|
||||
const { columns, i18n } = this.props;
|
||||
const { isSortDropdownOpen, sortKey, sortOrder, isNumeric } = this.state;
|
||||
const [{ name: sortedColumnName }] = columns.filter(
|
||||
({ key }) => key === sortKey
|
||||
);
|
||||
|
||||
const defaultSortedColumn = columns.find(({ key }) => key === sortKey);
|
||||
|
||||
if (!defaultSortedColumn) {
|
||||
throw new Error(
|
||||
'sortKey must match one of the column keys, check the sortColumns prop passed to <Sort />'
|
||||
);
|
||||
}
|
||||
|
||||
const sortedColumnName = defaultSortedColumn?.name;
|
||||
|
||||
const sortDropdownItems = columns
|
||||
.filter(({ key }) => key !== sortKey)
|
||||
|
||||
Reference in New Issue
Block a user