Skip to content

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

Remove project parameter for all calls to logs.all endpoint (#36627)

Joshen Limea9cfe1b397f
diff --git a/apps/studio/components/interfaces/Settings/Logs/Logs.types.ts b/apps/studio/components/interfaces/Settings/Logs/Logs.types.ts
index 06ee5653348..ef3597a06fb 100644
--- a/apps/studio/components/interfaces/Settings/Logs/Logs.types.ts
+++ b/apps/studio/components/interfaces/Settings/Logs/Logs.types.ts
@@ -20,7 +20,6 @@ export interface LogsWarning {
linkText?: string
}
export interface LogsEndpointParams {
- project: string // project ref
iso_timestamp_start?: string
iso_timestamp_end?: string
sql?: string
diff --git a/apps/studio/hooks/analytics/useLogsPreview.tsx b/apps/studio/hooks/analytics/useLogsPreview.tsx
index 1e6d5a69ef6..27a62b248f2 100644
--- a/apps/studio/hooks/analytics/useLogsPreview.tsx
+++ b/apps/studio/hooks/analytics/useLogsPreview.tsx
@@ -1,6 +1,6 @@
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
import dayjs from 'dayjs'
-import { useMemo, useState, useCallback } from 'react'
+import { useCallback, useMemo, useState } from 'react'
import {
LogsTableName,
@@ -22,8 +22,8 @@ import {
genDefaultQuery,
} from 'components/interfaces/Settings/Logs/Logs.utils'
import { get } from 'data/fetchers'
-import { useLogsUrlState } from './useLogsUrlState'
import { useFillTimeseriesSorted } from './useFillTimeseriesSorted'
+import { useLogsUrlState } from './useLogsUrlState'
import useTimeseriesUnixToIso from './useTimeseriesUnixToIso'
interface LogsPreviewHook {
@@ -83,12 +83,11 @@ function useLogsPreview({
const params: LogsEndpointParams = useMemo(() => {
const currentSql = genDefaultQuery(table, mergedFilters, limit)
return {
- project: projectRef,
iso_timestamp_start: timestampStart,
iso_timestamp_end: timestampEnd,
sql: currentSql,
}
- }, [projectRef, timestampStart, timestampEnd, table, mergedFilters, limit])
+ }, [timestampStart, timestampEnd, table, mergedFilters, limit])
const queryKey = useMemo(() => ['projects', projectRef, 'logs', params], [projectRef, params])
@@ -177,7 +176,6 @@ function useLogsPreview({
params: {
path: { ref: projectRef },
query: {
- project: projectRef,
sql: countQuerySql,
iso_timestamp_start: latestRefresh,
iso_timestamp_end: timestampEnd,
@@ -228,7 +226,6 @@ function useLogsPreview({
query: {
iso_timestamp_start: timestampStart,
iso_timestamp_end: timestampEnd,
- project: projectRef,
sql: chartQuery,
},
},
diff --git a/apps/studio/hooks/analytics/useLogsQuery.tsx b/apps/studio/hooks/analytics/useLogsQuery.tsx
index 77fec615d88..84ed4c54d45 100644
--- a/apps/studio/hooks/analytics/useLogsQuery.tsx
+++ b/apps/studio/hooks/analytics/useLogsQuery.tsx
@@ -1,5 +1,5 @@
import { useQuery } from '@tanstack/react-query'
-import { Dispatch, SetStateAction, useState, useEffect } from 'react'
+import { Dispatch, SetStateAction, useEffect, useState } from 'react'
import { IS_PLATFORM } from 'common'
import {
@@ -37,7 +37,6 @@ const useLogsQuery = (
const defaultHelper = getDefaultHelper(EXPLORER_DATEPICKER_HELPERS)
const [params, setParams] = useState<LogsEndpointParams>({
sql: initialParams?.sql || '',
- project: projectRef,
iso_timestamp_start: initialParams.iso_timestamp_start
? initialParams.iso_timestamp_start
: defaultHelper.calcFrom(),
diff --git a/apps/studio/hooks/analytics/useSingleLog.tsx b/apps/studio/hooks/analytics/useSingleLog.tsx
index 291c17ecb47..6ca288c2122 100644
--- a/apps/studio/hooks/analytics/useSingleLog.tsx
+++ b/apps/studio/hooks/analytics/useSingleLog.tsx
@@ -31,7 +31,7 @@ function useSingleLog({
const table = queryType ? LOGS_TABLES[queryType] : undefined
const sql = id && table ? genSingleLogQuery(table, id) : ''
- const params: LogsEndpointParams = { ...paramsToMerge, project: projectRef, sql }
+ const params: LogsEndpointParams = { ...paramsToMerge, sql }
const isWarehouseQuery = queryType === 'warehouse'
// Warehouse queries are handled differently