From e9d62fcf60a7ed0573dbc12831c237598056dae5 Mon Sep 17 00:00:00 2001 From: Daniil Chervyakov Date: Wed, 19 Apr 2023 20:41:11 +0300 Subject: [PATCH] Fix getting value in default sort func Just duplicate get logic from main Table code: https://github.com/gravity-ui/uikit/blob/main/src/components/Table/Table.tsx#L171 --- src/components/Table/hoc/withTableSorting/withTableSorting.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx index 994fd13b09..85f81fd83a 100644 --- a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx +++ b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx @@ -1,5 +1,6 @@ import React from 'react'; +import _get from 'lodash/get'; import _memoize from 'lodash/memoize'; import {block} from '../../../utils/cn'; @@ -44,7 +45,7 @@ export function withTableSorting( const displayName = `withTableSorting(${componentName})`; function defaultCompareFunction(itemA: I, itemB: I, columnId: string) { - if (itemA[columnId] === itemB[columnId]) { + if (_get(itemA, columnId) === _get(itemB, columnId)) { return 0; } else { return itemA[columnId] > itemB[columnId] ? 1 : -1;