fix: resolve remaining .total and .data references after response format migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-02 18:29:59 -08:00
parent ee9383d301
commit 07e6c5671d
4 changed files with 9 additions and 9 deletions

View File

@ -188,7 +188,7 @@ export default function SessionReplayPage() {
});
const sessions = sessionsData ?? [];
const total = sessionsData?.total ?? 0;
const total = sessions.length;
// Fetch session events when a session is selected
const {

View File

@ -894,7 +894,7 @@ export default function AlertRuleDetailPage() {
<div className="flex items-center justify-between">
<span className="text-sm text-muted-foreground">{t('alertRules.detail.totalEvents')}</span>
<span className="text-sm font-medium tabular-nums">
{eventsData?.total ?? alertEvents.length}
{alertEvents.length}
</span>
</div>
</div>

View File

@ -243,7 +243,7 @@ export default function MetricsPage() {
queryFn: () => apiClient<MetricsOverviewResponse>('/api/v1/monitor/metrics/overview'),
});
const overview = overviewData?.data;
const overview = overviewData;
const { data: serversData, isLoading: serversLoading, error } = useQuery({
queryKey: queryKeys.metrics.servers(),

View File

@ -473,16 +473,16 @@ export default function StandingOrderDetailPage() {
});
const executions = executionsData ?? [];
const totalExecutions = executionsData?.total ?? 0;
const totalExecutions = executions.length;
const totalPages = Math.ceil(totalExecutions / PAGE_SIZE);
// Compute stats from executions data
const stats: StandingOrderStats = (() => {
if (!executionsData) {
if (!executionsData || executions.length === 0) {
return { totalExecutions: 0, successRate: 0, avgDurationMs: 0 };
}
const allExecs = executionsData.data;
const total = executionsData.total;
const allExecs = executions;
const total = executions.length;
const completed = allExecs.filter((e) => e.status === 'completed').length;
const rate = total > 0 ? (completed / total) * 100 : 0;
const durations = allExecs.filter((e) => e.durationMs != null).map((e) => e.durationMs!);