The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: create DEFAULT_PROJECT_API_SERVICE_ID constant
phamhieub1916bef7374
diff --git a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsxindex 249b9f3c34d..512a986c997 100644--- a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx+++ b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx@@ -4,7 +4,7 @@ import { Input } from '@supabase/ui'import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks'import { SettingsLoadingState } from './SettingsLoadingState'-import { DEFAULT_API_SERVICE_ID } from './index.constants'+import { DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants'import Panel from 'components/to-be-cleaned/Panel'const DisplayApiSettings = () => {@@ -24,7 +24,7 @@ const DisplayApiSettings = () => {const isNotUpdatingJwtSecret =jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated// Get the API service- const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID)+ const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID)const apiKeys = apiService?.service_api_keys ?? []// api keys should not be empty. However it can be populated with a delay on project creationconst isApikeysEmpty = apiKeys.length === 0diff --git a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsxindex aea68e910dc..eb099f75976 100644--- a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx+++ b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx@@ -4,7 +4,7 @@ import { Input } from '@supabase/ui'import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks'import { SettingsLoadingState } from './SettingsLoadingState'-import { DEFAULT_API_SERVICE_ID } from './index.constants'+import { DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants'import Panel from 'components/to-be-cleaned/Panel'const DisplayConfigSettings = () => {@@ -26,7 +26,7 @@ const DisplayConfigSettings = () => {jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated// Get the API serviceconst jwtSecret = project?.jwt_secret ?? ''- const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID)+ const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID)const apiConfig = apiService?.app_config ?? {}return (diff --git a/studio/components/ui/ProjectSettings/index.constants.tsx b/studio/components/ui/ProjectSettings/index.constants.tsxdeleted file mode 100644index fdd902e2733..00000000000--- a/studio/components/ui/ProjectSettings/index.constants.tsx+++ /dev/null@@ -1 +0,0 @@-export const DEFAULT_API_SERVICE_ID = 1diff --git a/studio/hooks/queries/useProjectSettings.ts b/studio/hooks/queries/useProjectSettings.tsindex e97eba1a0c9..946c4cc074d 100644--- a/studio/hooks/queries/useProjectSettings.ts+++ b/studio/hooks/queries/useProjectSettings.ts@@ -1,5 +1,5 @@import { get } from 'lib/common/fetch'-import { API_URL } from 'lib/constants'+import { API_URL, DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants'import useSWR from 'swr'export function useProjectSettings(ref?: string) {@@ -10,7 +10,9 @@ export function useProjectSettings(ref?: string) {* check for data.services.service_api_keys, return a valid refresh interval if it's empty*/refreshInterval: function (data: any) {- const apiService = (data?.services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID)+ const apiService = (data?.services ?? []).find(+ (x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID+ )const apiKeys = apiService?.service_api_keys ?? []const interval = apiKeys.length === 0 ? 2000 : 0return interval@@ -26,5 +28,3 @@ export function useProjectSettings(ref?: string) {isError: !!anyError,}}--const DEFAULT_API_SERVICE_ID = 1diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.tsindex da1d6c4efaf..4dbba6f83e8 100644--- a/studio/lib/constants/infrastructure.ts+++ b/studio/lib/constants/infrastructure.ts@@ -140,3 +140,5 @@ export const PASSWORD_STRENGTH_PERCENTAGE = {export const DEFAULT_FREE_PROJECTS_LIMIT = 2export const STORAGE_FILE_SIZE_LIMIT_MAX_BYTES = 5 * 1024 * 1024 * 1024 // 5 GB++export const DEFAULT_PROJECT_API_SERVICE_ID = 1