Skip to content

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

chore(studio): remove Flag component and related context/hooks (#43103)

Mert YEREKAPANdf8729a82b18
diff --git a/apps/docs/components/Flag/Flag.tsx b/apps/docs/components/Flag/Flag.tsx
deleted file mode 100644
index ea95b33834f..00000000000
--- a/apps/docs/components/Flag/Flag.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import React, { ReactNode } from 'react'
-import { useFlag } from '~/hooks/useFlag'
-
-interface Props {
- children: ReactNode
- name: string
-}
-
-function Flag({ children, name }: Props) {
- const flagValue = useFlag(name)
- if (!flagValue) {
- return null
- }
- return <>{children}</>
-}
-
-export default Flag
diff --git a/apps/docs/components/Flag/FlagContext.ts b/apps/docs/components/Flag/FlagContext.ts
deleted file mode 100644
index 6c58ab54c84..00000000000
--- a/apps/docs/components/Flag/FlagContext.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { createContext } from 'react'
-
-const FlagContext = createContext({})
-
-export default FlagContext
diff --git a/apps/docs/components/Flag/FlagProvider.tsx b/apps/docs/components/Flag/FlagProvider.tsx
deleted file mode 100644
index 9e777ea190f..00000000000
--- a/apps/docs/components/Flag/FlagProvider.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { FC, PropsWithChildren, useEffect, useState } from 'react'
-// import createConfigCatClient from 'configcat-js'
-import FlagContext from './FlagContext'
-
-const FlagProvider: FC<PropsWithChildren<{}>> = ({ children }) => {
- const [store, setStore] = useState({})
- const { Provider } = FlagContext
-
- // useEffect(() => {
- // getFlags()
- // }, [])
-
- // const getFlags = async () => {
- // const setFlagValues = async () => {
- // const flagValues = await client.getAllValuesAsync()
- // const flagStore: any = {}
-
- // flagValues.forEach((item: any) => {
- // flagStore[item.settingKey] = item.settingValue
- // })
- // setStore(flagStore)
- // }
-
- // const client = createConfigCatClient(process.env.NEXT_PUBLIC_CONFIGCAT_SDK_KEY ?? '', {
- // configChanged: setFlagValues,
- // pollIntervalSeconds: 600,
- // })
-
- // await setFlagValues()
- // }
-
- return <Provider value={store}>{children}</Provider>
-}
-
-export default FlagProvider
diff --git a/apps/docs/hooks/useFlag.ts b/apps/docs/hooks/useFlag.ts
deleted file mode 100644
index 066a097a768..00000000000
--- a/apps/docs/hooks/useFlag.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { useContext } from 'react'
-import FlagContext from '@/components/Flag/FlagContext'
-
-export function useFlag(name: string) {
- const store: any = useContext(FlagContext)
- return store[name]
-}