diff --git a/studio/hooks/ui/useFlag.ts b/studio/hooks/ui/useFlag.ts index c93a1f045db..df47ac6144a 100644 --- a/studio/hooks/ui/useFlag.ts +++ b/studio/hooks/ui/useFlag.ts @@ -3,5 +3,14 @@ import FlagContext from 'components/ui/Flag/FlagContext' export function useFlag(name: string) { const store: any = useContext(FlagContext) + + const isObjectEmpty = (objectName: Object) => { + return Object.keys(objectName).length === 0 + } + + if (!isObjectEmpty(store) && store[name] === undefined) { + console.error(`Flag key "${name}" does not exist in flagStore`) + return false + } return store[name] } diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx index 6e35bb9cb6b..fe03cf0ddc3 100644 --- a/studio/pages/new/[slug].tsx +++ b/studio/pages/new/[slug].tsx @@ -380,34 +380,33 @@ const Wizard: NextPageWithLayout = () => { )} - {showNonProdFields && - cloudProviderEnabled( - + onCloudProviderChange(value)} + descriptionText="Cloud Provider (only for staging/local)" > - onCloudProviderChange(value)} - descriptionText="Cloud Provider (only for staging/local)" - > - {Object.values(PROVIDERS).map((providerObj) => { - const label = providerObj['name'] - const value = providerObj['id'] - return ( - - {label} - - ) - })} - - - )} + {Object.values(PROVIDERS).map((providerObj) => { + const label = providerObj['name'] + const value = providerObj['id'] + return ( + + {label} + + ) + })} + + + )}