fix: migrate tables to TanStack React Table v9

This commit is contained in:
naiba
2026-08-15 05:00:47 +00:00
parent 76d95ebbd4
commit c7368ae7dc
19 changed files with 223 additions and 94 deletions
+5 -5
View File
@@ -27,9 +27,10 @@ import {
} from "@/components/ui/table"
import { IconButton } from "@/components/xui/icon-button"
import { useServer } from "@/hooks/useServer"
import { selectableTableFeatures } from "@/lib/table"
import { joinIP } from "@/lib/utils"
import { ModelServerTaskResponse, ModelServer as Server } from "@/types"
import { ColumnDef, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table"
import { ColumnDef, flexRender, useTable } from "@tanstack/react-table"
import { useEffect, useMemo } from "react"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
@@ -51,7 +52,7 @@ export default function ServerPage() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [error])
const columns: ColumnDef<Server>[] = [
const columns: ColumnDef<typeof selectableTableFeatures, Server>[] = [
{
id: "select",
header: ({ table }) => (
@@ -71,7 +72,6 @@ export default function ServerPage() {
aria-label="Select row"
/>
),
enableSorting: false,
enableHiding: false,
},
{
@@ -217,10 +217,10 @@ export default function ServerPage() {
return data ?? []
}, [data])
const table = useReactTable({
const table = useTable({
features: selectableTableFeatures,
data: dataCache,
columns,
getCoreRowModel: getCoreRowModel(),
})
const selectedRows = table.getSelectedRowModel().rows