fix(ui): ограничить строки таблицы проб скорости

This commit is contained in:
Denozordec committed 2026-10-04 02:44:52 +07:00
1 parent 057281c246
commit 76a5e81fd4
6 files changed
+59 -7

No files matched your search

@@ -2,7 +2,7 @@
import { dataGridFeatures, type DataGridFeatures } from "@/components/reui/data-grid"
import { useMemo } from "react"
import { useMemo, useEffect } from "react"
import {
type ColumnDef,
useTable,
@@ -132,12 +132,20 @@ function ProbesSpeedProbesDataGrid({ rows, serverName }: ProbesSpeedProbesDataGr
const table = useTable({
features: dataGridFeatures,
manualPagination: true,
manualPagination: false,
autoResetPageIndex: false,
initialState: { pagination: { pageIndex: 0, pageSize: 50 } },
data: rows,
columns,
getRowId: (row) => row.id,
})
const { pageIndex, pageSize } = table.state.pagination
useEffect(() => {
const lastPage = Math.max(0, Math.ceil(rows.length / pageSize) - 1)
if (pageIndex > lastPage) table.setPageIndex(lastPage)
}, [rows.length, pageSize, pageIndex, table])
if (rows.length === 0) {
return (
<EmptyState
@@ -153,6 +161,7 @@ function ProbesSpeedProbesDataGrid({ rows, serverName }: ProbesSpeedProbesDataGr
<DataGridShell
table={table}
recordCount={rows.length}
pagination={rows.length > 50 || table.state.pagination.pageSize !== 50}
tableClassNames={{
headerRow: "border-b border-border",
bodyRow: cn("group/row", "[&[data-disabled=true]]:opacity-50"),