fix: use server-side sorting for paginated tables
Upgrade @cameleer/design-system to v0.1.1 which adds onSortChange callback to DataTable. Wire it up in Dashboard (exchanges), AuditLog, and RouteDetail (recent executions) so sorting triggers a new API request with sortField/sortDir instead of only sorting the current page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState, useMemo } from 'react';
|
||||
import { useState, useMemo, useCallback } from 'react';
|
||||
import { useParams, useNavigate, Link } from 'react-router';
|
||||
import {
|
||||
KpiStrip,
|
||||
@@ -260,6 +260,13 @@ export default function RouteDetail() {
|
||||
const timeTo = timeRange.end.toISOString();
|
||||
|
||||
const [activeTab, setActiveTab] = useState('performance');
|
||||
const [recentSortField, setRecentSortField] = useState<string>('startTime');
|
||||
const [recentSortDir, setRecentSortDir] = useState<'asc' | 'desc'>('desc');
|
||||
|
||||
const handleRecentSortChange = useCallback((key: string, dir: 'asc' | 'desc') => {
|
||||
setRecentSortField(key);
|
||||
setRecentSortDir(dir);
|
||||
}, []);
|
||||
|
||||
// ── API queries ────────────────────────────────────────────────────────────
|
||||
const { data: catalog } = useRouteCatalog();
|
||||
@@ -272,6 +279,8 @@ export default function RouteDetail() {
|
||||
timeTo,
|
||||
routeId: routeId || undefined,
|
||||
application: appId || undefined,
|
||||
sortField: recentSortField,
|
||||
sortDir: recentSortDir,
|
||||
offset: 0,
|
||||
limit: 50,
|
||||
});
|
||||
@@ -560,6 +569,7 @@ export default function RouteDetail() {
|
||||
onRowClick={(row) => navigate(`/exchanges/${row.executionId}`)}
|
||||
sortable
|
||||
pageSize={20}
|
||||
onSortChange={handleRecentSortChange}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user