The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): remove homeNew feature flag helper (#41984)
Pamela Chiafaa2588392fb
diff --git a/apps/studio/components/layouts/ProjectLayout/index.tsx b/apps/studio/components/layouts/ProjectLayout/index.tsxindex 98f597b8ad9..7f7a346593a 100644--- a/apps/studio/components/layouts/ProjectLayout/index.tsx+++ b/apps/studio/components/layouts/ProjectLayout/index.tsx@@ -12,7 +12,6 @@ import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganizationimport { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'import { withAuth } from 'hooks/misc/withAuth'import { usePHFlag } from 'hooks/ui/useFlag'-import { isHomeNewVariant, type HomeNewFlagValue } from 'lib/featureFlags/homeNew'import { PROJECT_STATUS } from 'lib/constants'import { useAppStateSnapshot } from 'state/app-state'import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'@@ -277,8 +276,7 @@ const ContentWrapper = ({ isLoading, isBlocking = true, children }: ContentWrappconst { ref } = useParams()const state = useDatabaseSelectorStateSnapshot()const { data: selectedProject } = useSelectedProjectQuery()- const homeNewVariant = usePHFlag<HomeNewFlagValue>('homeNew')- const isHomeNewFlag = isHomeNewVariant(homeNewVariant)+ const isHomeNew = usePHFlag('homeNew') === 'new-home'const isBranchesPage = router.pathname.includes('/project/[ref]/branches')const isSettingsPages = router.pathname.includes('/project/[ref]/settings')@@ -305,11 +303,11 @@ const ContentWrapper = ({ isLoading, isBlocking = true, children }: ContentWrapp// handle redirect to home for building stateconst shouldRedirectToHomeForBuilding =- isHomeNewFlag && requiresDbConnection && isProjectBuilding && !isBranchesPage && !isHomePage+ isHomeNew && requiresDbConnection && isProjectBuilding && !isBranchesPage && !isHomePage// We won't be showing the building state with the new home pageconst shouldShowBuildingState =- requiresDbConnection && isProjectBuilding && !isBranchesPage && !(isHomeNewFlag && isHomePage)+ requiresDbConnection && isProjectBuilding && !isBranchesPage && !(isHomeNew && isHomePage)useEffect(() => {if (shouldRedirectToHomeForBuilding && ref) {diff --git a/apps/studio/lib/featureFlags/homeNew.ts b/apps/studio/lib/featureFlags/homeNew.tsdeleted file mode 100644index c3659abc010..00000000000--- a/apps/studio/lib/featureFlags/homeNew.ts+++ /dev/null@@ -1,26 +0,0 @@-/**- * Temporary helper for the homeNew experiment rollout.- *- * PostHog requires string variants for A/B test analysis, but we initially implemented- * this flag as a boolean. This helper supports both formats during the migration period- * to avoid disrupting existing users.- *- * Once migration is complete, we'll use only string values ('control'/'new-home') and- * this helper can be removed.- */-export type HomeNewFlagValue = 'control' | 'new-home' | boolean | undefined--/**- * Checks if the homeNew flag value indicates the new home experience should be shown.- *- * @param value - The PostHog flag value (boolean, string variant, or undefined)- * @returns true if user should see the new home (true or 'new-home')- *- * @example- * const variant = usePHFlag<HomeNewFlagValue>('homeNew')- * const shouldShowNewHome = isHomeNewVariant(variant)- * // Returns true for: true or 'new-home'- * // Returns false for: false, 'control', or undefined- */-export const isHomeNewVariant = (value: HomeNewFlagValue): boolean =>- value === true || value === 'new-home'diff --git a/apps/studio/pages/new/[slug].tsx b/apps/studio/pages/new/[slug].tsxindex 7a4ca38d9b1..524a319390d 100644--- a/apps/studio/pages/new/[slug].tsx+++ b/apps/studio/pages/new/[slug].tsx@@ -53,7 +53,6 @@ import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganizationimport { withAuth } from 'hooks/misc/withAuth'import { usePHFlag } from 'hooks/ui/useFlag'import { DOCS_URL, PROJECT_STATUS, PROVIDERS, useDefaultProvider } from 'lib/constants'-import { isHomeNewVariant, type HomeNewFlagValue } from 'lib/featureFlags/homeNew'import { useTrack } from 'lib/telemetry/track'import { AWS_REGIONS, type CloudProvider } from 'shared-data'import type { NextPageWithLayout } from 'types'@@ -84,8 +83,7 @@ const Wizard: NextPageWithLayout = () => {const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')const showPostgresVersionSelector = useFlag('showPostgresVersionSelector')const cloudProviderEnabled = useFlag('enableFlyCloudProvider')- const homeNewVariant = usePHFlag<HomeNewFlagValue>('homeNew')- const isHomeNew = isHomeNewVariant(homeNewVariant)+ const isHomeNew = usePHFlag('homeNew') === 'new-home'const showNonProdFields = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'const isNotOnHigherPlan = !['team', 'enterprise', 'platform'].includes(currentOrg?.plan.id ?? '')diff --git a/apps/studio/pages/project/[ref]/index.tsx b/apps/studio/pages/project/[ref]/index.tsxindex c7a63014287..fe1e6e8903b 100644--- a/apps/studio/pages/project/[ref]/index.tsx+++ b/apps/studio/pages/project/[ref]/index.tsx@@ -3,14 +3,12 @@ import { HomeV2 } from 'components/interfaces/HomeNew/Home'import DefaultLayout from 'components/layouts/DefaultLayout'import { ProjectLayoutWithAuth } from 'components/layouts/ProjectLayout'import { usePHFlag } from 'hooks/ui/useFlag'-import { isHomeNewVariant, type HomeNewFlagValue } from 'lib/featureFlags/homeNew'import type { NextPageWithLayout } from 'types'const HomePage: NextPageWithLayout = () => {- const homeNewVariant = usePHFlag<HomeNewFlagValue>('homeNew')- const isHomeNewPH = isHomeNewVariant(homeNewVariant)+ const isHomeNew = usePHFlag('homeNew') === 'new-home'- if (isHomeNewPH) {+ if (isHomeNew) {return <HomeV2 />}return <Home />