Skip to content

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

Add IS_PLATFORM checks for some unnecessary queries and UI for local (#33557)

Joshen Lim8b4fb55b54f4
diff --git a/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx b/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx
index 43123d2c2ea..53e0ff6f0e2 100644
--- a/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Logs/PreviewFilterPanel.tsx
@@ -8,6 +8,7 @@ import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import CSVButton from 'components/ui/CSVButton'
import DatabaseSelector from 'components/ui/DatabaseSelector'
import { useLoadBalancersQuery } from 'data/read-replicas/load-balancers-query'
+import { IS_PLATFORM } from 'lib/constants'
import { Button, Input, Tooltip, TooltipContent, TooltipTrigger, cn } from 'ui'
import DatePickers from './Logs.DatePickers'
import {
@@ -72,7 +73,8 @@ const PreviewFilterPanel = ({
const { data: loadBalancers } = useLoadBalancersQuery({ projectRef: ref })
// [Joshen] These are the routes tested that can show replica logs
- const showDatabaseSelector = LOG_ROUTES_WITH_REPLICA_SUPPORT.includes(router.pathname)
+ const showDatabaseSelector =
+ IS_PLATFORM && LOG_ROUTES_WITH_REPLICA_SUPPORT.includes(router.pathname)
const hasEdits = search !== defaultSearchValue
diff --git a/apps/studio/data/analytics/warehouse-collections-query.ts b/apps/studio/data/analytics/warehouse-collections-query.ts
index 75de23c686f..4fde686a646 100644
--- a/apps/studio/data/analytics/warehouse-collections-query.ts
+++ b/apps/studio/data/analytics/warehouse-collections-query.ts
@@ -1,5 +1,6 @@
import { useQuery } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import { analyticsKeys } from './keys'
type WarehouseCollectionsVariables = {
@@ -35,6 +36,6 @@ export const useWarehouseCollectionsQuery = (
analyticsKeys.warehouseCollections(projectRef),
({ signal }) => getWarehouseCollections({ projectRef }, signal),
{
- enabled: enabled && !!projectRef,
+ enabled: enabled && !!projectRef && IS_PLATFORM,
}
)
diff --git a/apps/studio/data/analytics/warehouse-tenant-query.ts b/apps/studio/data/analytics/warehouse-tenant-query.ts
index 19c35c557a1..624a6719641 100644
--- a/apps/studio/data/analytics/warehouse-tenant-query.ts
+++ b/apps/studio/data/analytics/warehouse-tenant-query.ts
@@ -1,7 +1,8 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
-import { analyticsKeys } from './keys'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import { ResponseError } from 'types'
+import { analyticsKeys } from './keys'
export type WarehouseTenantVariables = {
projectRef: string
@@ -41,7 +42,7 @@ export const useWarehouseTenantQuery = <TData = WarehouseTenantData>(
analyticsKeys.warehouseTenant(projectRef),
({ signal }) => getWarehouseTenant({ projectRef }, signal),
{
- enabled: enabled && !!projectRef,
+ enabled: enabled && !!projectRef && IS_PLATFORM,
staleTime: Infinity,
// 2H mins cache time
cacheTime: 120 * 60 * 1000,
diff --git a/apps/studio/data/read-replicas/load-balancers-query.ts b/apps/studio/data/read-replicas/load-balancers-query.ts
index ceb0058d080..37d35418886 100644
--- a/apps/studio/data/read-replicas/load-balancers-query.ts
+++ b/apps/studio/data/read-replicas/load-balancers-query.ts
@@ -2,6 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import type { components } from 'data/api'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import type { ResponseError } from 'types'
import { replicaKeys } from './keys'
@@ -37,7 +38,7 @@ export const useLoadBalancersQuery = <TData = LoadBalancersData>(
replicaKeys.loadBalancers(projectRef),
({ signal }) => getLoadBalancers({ projectRef }, signal),
{
- enabled: enabled && typeof projectRef !== 'undefined',
+ enabled: enabled && typeof projectRef !== 'undefined' && IS_PLATFORM,
...options,
}
)