Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(studio): fall back to unified preset for an unrecognized query-performance preset (#50348)

claude[bot]8bbd1d3048e3
diff --git a/apps/studio/components/interfaces/QueryPerformance/hooks/useIndexInvalidation.ts b/apps/studio/components/interfaces/QueryPerformance/hooks/useIndexInvalidation.ts
index 48a368a6754..9698c8c3d15 100644
--- a/apps/studio/components/interfaces/QueryPerformance/hooks/useIndexInvalidation.ts
+++ b/apps/studio/components/interfaces/QueryPerformance/hooks/useIndexInvalidation.ts
@@ -30,7 +30,11 @@ export function useIndexInvalidation() {
const { invalidate: invalidateTableIndexAdvisor } = useTableIndexAdvisor()
- const preset = QUERY_PERFORMANCE_PRESET_MAP[urlPreset as QUERY_PERFORMANCE_REPORT_TYPES]
+ // Falls back to UNIFIED so an unrecognized preset param doesn't resolve to
+ // undefined and crash generateQueryPerformanceSql.
+ const preset =
+ QUERY_PERFORMANCE_PRESET_MAP[urlPreset as QUERY_PERFORMANCE_REPORT_TYPES] ??
+ QUERY_PERFORMANCE_PRESET_MAP[QUERY_PERFORMANCE_REPORT_TYPES.UNIFIED]
const orderBy = !!sort ? ({ column: sort, order } as QueryPerformanceSort) : undefined
const roles = router?.query?.roles ?? []