From 2ec18f116084408354c15eac15cff833c956a4c7 Mon Sep 17 00:00:00 2001 From: Guilherme Datilio Ribeiro Date: Thu, 30 Nov 2023 08:27:09 -0300 Subject: [PATCH] fix: fixed typeError when sorting arrays (#15288) --- packages/react/src/components/DataTable/tools/sorting.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/DataTable/tools/sorting.js b/packages/react/src/components/DataTable/tools/sorting.js index 7fc2f51b26b4..373533a13412 100644 --- a/packages/react/src/components/DataTable/tools/sorting.js +++ b/packages/react/src/components/DataTable/tools/sorting.js @@ -35,8 +35,8 @@ export const compare = (a, b, locale = 'en') => { // if column has React elements, this should sort by the child string if there is one if (typeof a === 'object' && typeof b === 'object') { if ( - typeof a.props.children === 'string' && - typeof b.props.children === 'string' + typeof a.props?.children === 'string' && + typeof b.props?.children === 'string' ) { return compareStrings(a.props.children, b.props.children, locale); }