#8126·grommet

fix(DataTable): sorting crashes when properties are null or undefined (#6282)

Author: AgentiqQuantumCreated Sep 11, 2026Updated Sep 11, 2026

Bug Description

When using the DataTable component, if any item in the dataset contains properties that are null or undefined, sorting by that column causes a runtime crash or failure during the filtering and sorting phase.

Expected Behavior

The DataTable should handle null or undefined property values gracefully (e.g., treating them as empty strings '') without breaking or throwing errors when sorting.

Steps to Reproduce

  1. Render a DataTable with a dataset where one or more records have null or undefined values in a sortable column.
  2. Click on the column header to sort.
  3. Observe the crash/error.

Proposed Solution / Context

This can be resolved by mapping dataset properties during the sorting/filtering preparation step (e.g., inside useMemo in DataTable.js) to safely convert null/mil/undefined values into fallback empty strings before invoking filterAndSortData.

(Related to #6282)