Skip to content

Commit

Permalink
fix: use server side sorting for config summary
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Jun 6, 2024
1 parent 1ac61fe commit 5876f2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Configs/ConfigSummary/ConfigSummaryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ConfigSummary } from "@flanksource-ui/api/types/configs";
import { Badge } from "@flanksource-ui/ui/Badge/Badge";
import { CountBadge } from "@flanksource-ui/ui/Badge/CountBadge";
import { DataTable } from "@flanksource-ui/ui/DataTable";
import useReactTableSortState from "@flanksource-ui/ui/DataTable/Hooks/useReactTableSortState";
import { CellContext, ColumnDef, Row } from "@tanstack/react-table";
import { useCallback, useMemo } from "react";
import { BiLabel } from "react-icons/bi";
Expand Down Expand Up @@ -266,6 +267,8 @@ export default function ConfigSummaryList({
return [...newColumns, ...configSummaryColumns];
}, [groupBy, groupByTags]);

const [sortState, updateSortState] = useReactTableSortState();

return (
<DataTable
stickyHead
Expand All @@ -278,6 +281,9 @@ export default function ConfigSummaryList({
hiddenColumns={
groupBy.length > 1 ? groupBy.slice(0, groupBy.length - 1) : undefined
}
enableServerSideSorting
onTableSortByChanged={updateSortState}
tableSortByState={sortState}
handleRowClick={handleRowClick}
tableStyle={{ borderSpacing: "0" }}
isLoading={isLoading}
Expand Down

0 comments on commit 5876f2c

Please sign in to comment.