diff --git a/apps/web/src/components/SortableHeader/SortableHeader.tsx b/apps/web/src/components/SortableHeader/SortableHeader.tsx index ed2763b01..7e6b7052a 100644 --- a/apps/web/src/components/SortableHeader/SortableHeader.tsx +++ b/apps/web/src/components/SortableHeader/SortableHeader.tsx @@ -10,6 +10,11 @@ type SortableHeaderProps = { * mounts with no sorting state of its own, so the column reads as unsorted however it is ordered. */ sortOrder?: 'asc' | 'desc'; + /** + * Passed by a table in server mode, which does not return its page index to the first page when + * the sort changes, so the page controls would keep counting from the page the user left. + */ + table?: TanstackTable.Table; }; const SORT_ICONS = { asc: ChevronUpIcon, desc: ChevronDownIcon }; @@ -18,14 +23,17 @@ const SORT_ICONS = { asc: ChevronUpIcon, desc: ChevronDownIcon }; * A clickable column label. `DataTableHead` renders whatever the column supplies, so the sort * affordance lives here rather than coming from the table. */ -export const SortableHeader = ({ column, label, sortOrder }: SortableHeaderProps) => { +export const SortableHeader = ({ column, label, sortOrder, table }: SortableHeaderProps) => { const sorted = sortOrder ?? column.getIsSorted(); const Icon = sorted ? SORT_ICONS[sorted] : ChevronsUpDownIcon; return (