fix(instances): keep table page across live metric updates
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 7s

Live WS metrics replace the table data every second, and TanStack
Table's default autoResetPageIndex snapped the list back to page 1.
Disable the auto reset and go back to page 1 only when search or
filters change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 02:44:39 +05:00
parent 7e1580579d
commit 613015cf05

View File

@@ -915,8 +915,18 @@ export default function InstancesPage() {
getFacetedRowModel: getFacetedRowModel(), getFacetedRowModel: getFacetedRowModel(),
getFacetedUniqueValues: getFacetedUniqueValues(), getFacetedUniqueValues: getFacetedUniqueValues(),
initialState: { pagination: { pageSize: 25 } }, initialState: { pagination: { pageSize: 25 } },
// Live WS metrics replace `data` every second; without this the table
// would snap back to page 1 on every tick.
autoResetPageIndex: false,
}); });
// Filters can shrink the row set below the current page — go back to page 1
// only when the user actually changes filtering.
useEffect(() => {
table.setPageIndex(0);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [columnFilters, search, typeTab, statusFilter, serverFilter, nodeFilter]);
// ==================== Render ==================== // ==================== Render ====================
return ( return (
<div className="space-y-4"> <div className="space-y-4">