diff --git a/src/components/InfiniteTable/InfiniteTable.tsx b/src/components/InfiniteTable/InfiniteTable.tsx index 9de4c80..040676a 100644 --- a/src/components/InfiniteTable/InfiniteTable.tsx +++ b/src/components/InfiniteTable/InfiniteTable.tsx @@ -189,7 +189,10 @@ const InfiniteTableComp = forwardRef( | undefined => { const state = gridRef?.current?.api.getColumnState()!; - const columnsWithSort = state.filter((col) => col.sort); + const columnsWithSort = state + .filter((col) => col.sort) + .sort((a, b) => (a.sortIndex || 0) - (b.sortIndex || 0)); + if (columnsWithSort.length === 0) { return undefined; }