From def3abd1d94f2a80de5d6ce80e204c869999c3c9 Mon Sep 17 00:00:00 2001 From: Marcel Overdijk Date: Wed, 23 Jul 2025 16:17:27 +0200 Subject: [PATCH] fix(sort): treat null values the same as undefined in SortUndefined --- packages/table-core/src/utils/getSortedRowModel.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/table-core/src/utils/getSortedRowModel.ts b/packages/table-core/src/utils/getSortedRowModel.ts index eb5e9d5729..3c1246f9fa 100644 --- a/packages/table-core/src/utils/getSortedRowModel.ts +++ b/packages/table-core/src/utils/getSortedRowModel.ts @@ -61,8 +61,8 @@ export function getSortedRowModel(): ( const aValue = rowA.getValue(sortEntry.id) const bValue = rowB.getValue(sortEntry.id) - const aUndefined = aValue === undefined - const bUndefined = bValue === undefined + const aUndefined = aValue == null // true for null or undefined + const bUndefined = bValue == null // true for null or undefined if (aUndefined || bUndefined) { if (sortUndefined === 'first') return aUndefined ? -1 : 1