build: default flags but maintain togglability (#5702)
fix: default flags but maintain togglability
This commit is contained in:
parent
1f871d4e73
commit
21a2863ae3
@ -55,12 +55,13 @@ export enum BaseVariant {
|
|||||||
Enabled = 'enabled',
|
Enabled = 'enabled',
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useBaseFlag(flag: string): BaseVariant {
|
export function useBaseFlag(flag: string, defaultValue = BaseVariant.Control): BaseVariant {
|
||||||
switch (useFeatureFlagsContext().flags[flag]) {
|
switch (useFeatureFlagsContext().flags[flag]) {
|
||||||
case 'enabled':
|
case 'enabled':
|
||||||
return BaseVariant.Enabled
|
return BaseVariant.Enabled
|
||||||
case 'control':
|
case 'control':
|
||||||
default:
|
|
||||||
return BaseVariant.Control
|
return BaseVariant.Control
|
||||||
|
default:
|
||||||
|
return defaultValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ export function isTestEnv(): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isStagingEnv(): boolean {
|
export function isStagingEnv(): boolean {
|
||||||
|
// NB: This is set in vercel builds.
|
||||||
return Boolean(process.env.REACT_APP_STAGING)
|
return Boolean(process.env.REACT_APP_STAGING)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user