diff --git a/client/src/components/Settings/Clients/ClientsTable.js b/client/src/components/Settings/Clients/ClientsTable.js index ac613164..065157bd 100644 --- a/client/src/components/Settings/Clients/ClientsTable.js +++ b/client/src/components/Settings/Clients/ClientsTable.js @@ -4,7 +4,7 @@ import { Trans, withTranslation } from 'react-i18next'; import ReactTable from 'react-table'; import { MODAL_TYPE } from '../../../helpers/constants'; -import { splitByNewLine, countClientsStatistics } from '../../../helpers/helpers'; +import { splitByNewLine, countClientsStatistics, sortIp } from '../../../helpers/helpers'; import Card from '../../ui/Card'; import Modal from './Modal'; import CellWrap from '../../ui/CellWrap'; @@ -106,6 +106,7 @@ class ClientsTable extends Component { ); }, + sortMethod: sortIp, }, { Header: this.props.t('table_name'), diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 6753062a..2546d5b9 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -754,8 +754,10 @@ const getAddressesComparisonBytes = (item) => { */ export const sortIp = (a, b) => { try { - const comparisonBytesA = getAddressesComparisonBytes(a); - const comparisonBytesB = getAddressesComparisonBytes(b); + const comparisonBytesA = Array.isArray(a) + ? getAddressesComparisonBytes(a[0]) : getAddressesComparisonBytes(a); + const comparisonBytesB = Array.isArray(b) + ? getAddressesComparisonBytes(b[0]) : getAddressesComparisonBytes(b); for (let i = 0; i < comparisonBytesA.length; i += 1) { const byteA = comparisonBytesA[i];