mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +08:00
## 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>
36 lines
1001 B
TypeScript
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}
|
|
/>
|
|
)
|
|
}
|