Files
supabase/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.tsx
Jordi Enric 2e1795dfa0 feat(studio): add pagination to query performance page FE-2774 (#43697)
## Problem

The Query Performance page loaded all results in a single query with a
fixed limit of 20 rows, giving users no way to browse beyond the first
page. There was also no way to control how many rows were shown at once.

## Fix

adds pagination 

## How to test

- Navigate to `/observability/query-performance` in Studio
- scroll to bottom
- should automatically load more results

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 15:27:43 +01:00

36 lines
1001 B
TypeScript

import { useParams } from 'common'
import { useEffect } from 'react'
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import { PresetHookResult } from '../Reports/Reports.utils'
import { QueryPerformanceInfiniteHook } from './useQueryPerformanceQuery'
import { WithStatements } from './WithStatements/WithStatements'
interface QueryPerformanceProps {
queryHitRate: PresetHookResult
queryPerformanceQuery: QueryPerformanceInfiniteHook
queryMetrics: PresetHookResult
}
export const QueryPerformance = ({
queryHitRate,
queryPerformanceQuery,
queryMetrics,
}: QueryPerformanceProps) => {
const { ref } = useParams()
const state = useDatabaseSelectorStateSnapshot()
useEffect(() => {
state.setSelectedDatabaseId(ref)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ref])
return (
<WithStatements
queryHitRate={queryHitRate}
queryPerformanceQuery={queryPerformanceQuery}
queryMetrics={queryMetrics}
/>
)
}