mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 21:29:08 +03:00
add a rudimentary console.error to catch misnamed flags
This commit is contained in:
1 parent
a934299db0
commit
34fef2dade
2 files changed
+35
-27
No files matched your search
@@ -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]
|
||||
}
|
||||
+26
-27
@@ -380,34 +380,33 @@ const Wizard: NextPageWithLayout = () => {
|
||||
</Panel.Content>
|
||||
)}
|
||||
|
||||
{showNonProdFields &&
|
||||
cloudProviderEnabled(
|
||||
<Panel.Content
|
||||
className={[
|
||||
'border-b',
|
||||
'border-panel-border-interior-light dark:border-panel-border-interior-dark',
|
||||
].join(' ')}
|
||||
{cloudProviderEnabled && showNonProdFields && (
|
||||
<Panel.Content
|
||||
className={[
|
||||
'border-b',
|
||||
'border-panel-border-interior-light dark:border-panel-border-interior-dark',
|
||||
].join(' ')}
|
||||
>
|
||||
<Listbox
|
||||
layout="horizontal"
|
||||
label="Cloud Provider"
|
||||
type="select"
|
||||
value={cloudProvider}
|
||||
onChange={(value) => onCloudProviderChange(value)}
|
||||
descriptionText="Cloud Provider (only for staging/local)"
|
||||
>
|
||||
<Listbox
|
||||
layout="horizontal"
|
||||
label="Cloud Provider"
|
||||
type="select"
|
||||
value={cloudProvider}
|
||||
onChange={(value) => onCloudProviderChange(value)}
|
||||
descriptionText="Cloud Provider (only for staging/local)"
|
||||
>
|
||||
{Object.values(PROVIDERS).map((providerObj) => {
|
||||
const label = providerObj['name']
|
||||
const value = providerObj['id']
|
||||
return (
|
||||
<Listbox.Option key={value} label={label} value={value}>
|
||||
<span className="text-scale-1200">{label}</span>
|
||||
</Listbox.Option>
|
||||
)
|
||||
})}
|
||||
</Listbox>
|
||||
</Panel.Content>
|
||||
)}
|
||||
{Object.values(PROVIDERS).map((providerObj) => {
|
||||
const label = providerObj['name']
|
||||
const value = providerObj['id']
|
||||
return (
|
||||
<Listbox.Option key={value} label={label} value={value}>
|
||||
<span className="text-scale-1200">{label}</span>
|
||||
</Listbox.Option>
|
||||
)
|
||||
})}
|
||||
</Listbox>
|
||||
</Panel.Content>
|
||||
)}
|
||||
|
||||
<Panel.Content className="border-b border-panel-border-interior-light dark:border-panel-border-interior-dark">
|
||||
<Input
|
||||
|
||||
Reference in new issue
Block a user