Skip to content

Commit 2f84082

Browse files
committed
fix: change the position of the annotation
1 parent bd17d86 commit 2f84082

File tree

3 files changed

+1
-9
lines changed

3 files changed

+1
-9
lines changed

packages/table-core/src/features/RowSorting.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,10 @@ export const RowSorting: TableFeature = {
326326
column: Column<TData, TValue>,
327327
table: Table<TData>
328328
): void => {
329-
// Add deprecation warning for sortUndefined
330329
if (column.columnDef.sortUndefined && !column.columnDef.sortEmpty) {
331330
if (process.env.NODE_ENV !== 'production') {
332331
console.warn(
333-
'[TanStack Table] sortUndefined is deprecated. ' +
334-
'Please use sortEmpty instead for more comprehensive empty value handling. ' +
335-
`Column: ${column.id}`
332+
`[TanStack Table] sortUndefined is deprecated. Please use sortEmpty instead for more comprehensive empty value handling. Column: ${column.id}`
336333
)
337334
}
338335
}

packages/table-core/src/utils/getSortedRowModel.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export function getSortedRowModel<TData extends RowData>(): (
6262

6363
let sortInt = 0
6464

65-
// Handle sortEmpty option first (takes precedence over sortUndefined)
6665
if (sortEmpty) {
6766
const aValue = rowA.getValue(sortEntry.id)
6867
const bValue = rowB.getValue(sortEntry.id)
@@ -75,11 +74,8 @@ export function getSortedRowModel<TData extends RowData>(): (
7574
}
7675

7776
if (aIsEmpty || bIsEmpty) {
78-
// Determine position based on sortEmpty setting
7977
const emptyPosition = sortEmpty === 'last' ? 1 : -1
8078
sortInt = aIsEmpty ? emptyPosition : -emptyPosition
81-
82-
// Return immediately - empty values maintain their position regardless of desc
8379
return sortInt
8480
}
8581
}

packages/table-core/tests/sortEmpty.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ describe('sortEmpty option', () => {
223223
columnHelper.accessor('price', {
224224
header: 'Price',
225225
sortEmpty: 'last',
226-
// No custom isEmptyValue - should use default
227226
}),
228227
]
229228

0 commit comments

Comments
 (0)