Skip to content

Commit

Permalink
fix: fixed typeError when sorting arrays (carbon-design-system#15288)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidari authored Nov 30, 2023
1 parent 2633b45 commit 2ec18f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/components/DataTable/tools/sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2ec18f1

Please sign in to comment.