mirror of
https://github.com/supabase/supabase.git
synced 2026-06-22 03:52:46 +08:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? This introduces Query Insights. It's the first edition of possible future updates. This takes our old prototype and builds upon it for a more action driven insights view. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ali Waseem <waseema393@gmail.com>
36 lines
972 B
TypeScript
36 lines
972 B
TypeScript
import { useEffect } from 'react'
|
|
|
|
import { WithStatements } from './WithStatements/WithStatements'
|
|
import { useParams } from 'common'
|
|
import { DbQueryHook } from 'hooks/analytics/useDbQuery'
|
|
import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
|
|
import { PresetHookResult } from '../Reports/Reports.utils'
|
|
|
|
interface QueryPerformanceProps {
|
|
queryHitRate: PresetHookResult
|
|
queryPerformanceQuery: DbQueryHook<any>
|
|
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}
|
|
/>
|
|
)
|
|
}
|