Skip to content

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

Some fixes for local studio (#37147)

Joshen Limb4717e17876f
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
index a0a3304b43a..97f5bddd388 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/LayoutHeader.tsx
@@ -136,7 +136,7 @@ const LayoutHeader = ({
{selectedProject && (
<>
<LayoutHeaderDivider />
- <BranchDropdown />
+ {IS_PLATFORM && <BranchDropdown />}
</>
)}
</motion.div>
diff --git a/apps/studio/data/api-keys/api-keys-query.ts b/apps/studio/data/api-keys/api-keys-query.ts
index de87ed9c42b..a78f3c031d1 100644
--- a/apps/studio/data/api-keys/api-keys-query.ts
+++ b/apps/studio/data/api-keys/api-keys-query.ts
@@ -2,6 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
import { ResponseError } from 'types'
+import { IS_PLATFORM } from 'lib/constants'
import { apiKeysKeys } from './keys'
type LegacyKeys = {
@@ -74,7 +75,7 @@ export const useAPIKeysQuery = <TData = APIKeysData>(
apiKeysKeys.list(projectRef),
({ signal }) => getAPIKeys({ projectRef, reveal }, signal),
{
- enabled: enabled && !!projectRef,
+ enabled: IS_PLATFORM && enabled && !!projectRef,
...options,
}
)
diff --git a/apps/studio/data/api-keys/legacy-api-keys-status-query.ts b/apps/studio/data/api-keys/legacy-api-keys-status-query.ts
index 964f2f49d54..d768d3713e7 100644
--- a/apps/studio/data/api-keys/legacy-api-keys-status-query.ts
+++ b/apps/studio/data/api-keys/legacy-api-keys-status-query.ts
@@ -1,5 +1,6 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import { ResponseError } from 'types'
import { apiKeysKeys } from './keys'
@@ -29,13 +30,13 @@ type LegacyAPIKeysStatusData = Awaited<ReturnType<typeof getLegacyAPIKeysStatus>
export const useLegacyAPIKeysStatusQuery = <TData = LegacyAPIKeysStatusData>(
{ projectRef }: LegacyAPIKeysStatusVariables,
- { ...options }: UseQueryOptions<LegacyAPIKeysStatusData, ResponseError, TData> = {}
+ { enabled, ...options }: UseQueryOptions<LegacyAPIKeysStatusData, ResponseError, TData> = {}
) =>
useQuery<LegacyAPIKeysStatusData, ResponseError, TData>(
apiKeysKeys.status(projectRef),
({ signal }) => getLegacyAPIKeysStatus({ projectRef }, signal),
{
- enabled: !!projectRef,
+ enabled: IS_PLATFORM && enabled && !!projectRef,
...options,
}
)
diff --git a/apps/studio/data/branches/branch-diff-query.ts b/apps/studio/data/branches/branch-diff-query.ts
index eba205e1908..bcff017becc 100644
--- a/apps/studio/data/branches/branch-diff-query.ts
+++ b/apps/studio/data/branches/branch-diff-query.ts
@@ -1,6 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import type { ResponseError } from 'types'
import { branchKeys } from './keys'
@@ -50,7 +51,7 @@ export const useBranchDiffQuery = (
branchKeys.diff(projectRef, branchId),
() => getBranchDiff({ branchId, includedSchemas }),
{
- enabled: enabled && typeof branchId !== 'undefined' && branchId !== '',
+ enabled: IS_PLATFORM && enabled && typeof branchId !== 'undefined' && branchId !== '',
...options,
}
)
diff --git a/apps/studio/data/branches/branch-query.ts b/apps/studio/data/branches/branch-query.ts
index c4a6b6ddfbd..a7a5c99a66d 100644
--- a/apps/studio/data/branches/branch-query.ts
+++ b/apps/studio/data/branches/branch-query.ts
@@ -1,6 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import type { ResponseError } from 'types'
import { branchKeys } from './keys'
@@ -32,7 +33,7 @@ export const useBranchQuery = <TData = BranchData>(
branchKeys.detail(projectRef, id),
({ signal }) => getBranch({ id }, signal),
{
- enabled: enabled && typeof id !== 'undefined',
+ enabled: IS_PLATFORM && enabled && typeof id !== 'undefined',
...options,
}
)
diff --git a/apps/studio/data/branches/branches-query.ts b/apps/studio/data/branches/branches-query.ts
index d83de6a6f4a..c6c82abd22f 100644
--- a/apps/studio/data/branches/branches-query.ts
+++ b/apps/studio/data/branches/branches-query.ts
@@ -1,6 +1,8 @@
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 { branchKeys } from './keys'
@@ -39,5 +41,5 @@ export const useBranchesQuery = <TData = BranchesData>(
useQuery<BranchesData, BranchesError, TData>(
branchKeys.list(projectRef),
({ signal }) => getBranches({ projectRef }, signal),
- { enabled: enabled && typeof projectRef !== 'undefined', ...options }
+ { enabled: IS_PLATFORM && enabled && typeof projectRef !== 'undefined', ...options }
)
diff --git a/apps/studio/pages/api/cli-release-version.ts b/apps/studio/pages/api/cli-release-version.ts
index 7c6ce96b38a..4719fcfd946 100644
--- a/apps/studio/pages/api/cli-release-version.ts
+++ b/apps/studio/pages/api/cli-release-version.ts
@@ -8,7 +8,7 @@ type GitHubRepositoryRelease = {
published_at: string
}
-const current = `v${process.env.CURRENT_CLI_VERSION}`
+const current = process.env.CURRENT_CLI_VERSION ? `v${process.env.CURRENT_CLI_VERSION}` : undefined
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {