fix(instances): keep table page across live metric updates
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 7s
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:
@@ -915,8 +915,18 @@ export default function InstancesPage() {
|
||||
getFacetedRowModel: getFacetedRowModel(),
|
||||
getFacetedUniqueValues: getFacetedUniqueValues(),
|
||||
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 ====================
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
|
||||
Reference in New Issue
Block a user