Skip to content

Commit eb06922

Browse files
committed
More permissive sort column location
1 parent c9ace3b commit eb06922

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/source/src/use-column-sort.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ type Result = Pick<DataEditorProps, "getCellContent"> & {
4646
export function useColumnSort(p: Props): Result {
4747
const { sort, rows, getCellContent: getCellContentIn } = p;
4848

49-
const sortCol = sort === undefined ? undefined : p.columns.indexOf(sort.column);
49+
let sortCol =
50+
sort === undefined
51+
? undefined
52+
: p.columns.findIndex(c => sort.column === c || (c.id !== undefined && sort.column.id === c.id));
53+
if (sortCol === -1) sortCol = undefined;
5054

5155
// This scales to about 100k rows. Beyond that things take a pretty noticeable amount of time
5256
// The performance "issue" from here on out seems to be the lookup to get the value. Not sure

0 commit comments

Comments
 (0)