The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: also apply a check to the count request
Jonathan Summers-Muir64b97859d4bd
diff --git a/studio/hooks/analytics/useLogsPreview.tsx b/studio/hooks/analytics/useLogsPreview.tsxindex 81125d0cbf9..fc1273c0f68 100644--- a/studio/hooks/analytics/useLogsPreview.tsx+++ b/studio/hooks/analytics/useLogsPreview.tsx@@ -93,13 +93,22 @@ function useLogsPreview(} = useSWRInfinite<Logs>(getKeyLogs, get, { revalidateOnFocus: false, dedupingInterval: 3000 })let logData: LogData[] = []- const countUrl = `${API_URL}/projects/${projectRef}/analytics/endpoints/logs.all?${genQueryParams(- {- ...params,- sql: genCountQuery(table),- period_start: String(latestRefresh),- } as any- )}`+ const countUrl = () => {++ // check that SQL is ready for the count request+ if(!params.sql || !params.rawSql) {+ // return empty url to restrict unnecessary requests to api+ return ''+ }++ return `${API_URL}/projects/${projectRef}/analytics/endpoints/logs.all?${genQueryParams(+ {+ ...params,+ sql: genCountQuery(table),+ period_start: String(latestRefresh),+ } as any+ )}`+ }const { data: countData } = useSWR<Count>(countUrl, get, {revalidateOnFocus: false,