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
- Render a
DataTablewith a dataset where one or more records havenullorundefinedvalues in a sortable column. - Click on the column header to sort.
- 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)
Source: grommet/grommet