mirror of
https://github.com/apache/superset.git
synced 2024-09-06 13:57:40 -04:00
Add warnings if feature flags are read before initialization. (#21201)
This commit is contained in:
parent
17ad0d80de
commit
5811262cf2
@ -84,5 +84,13 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isFeatureEnabled(feature: FeatureFlag) {
|
export function isFeatureEnabled(feature: FeatureFlag) {
|
||||||
return window && window.featureFlags && !!window.featureFlags[feature];
|
try {
|
||||||
|
return !!window.featureFlags[feature];
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`Failed to query feature flag ${feature} (see error below)`);
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,5 +28,13 @@ export function initFeatureFlags(featureFlags: FeatureFlagMap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isFeatureEnabled(feature: FeatureFlag) {
|
export function isFeatureEnabled(feature: FeatureFlag) {
|
||||||
return window && window.featureFlags && !!window.featureFlags[feature];
|
try {
|
||||||
|
return !!window.featureFlags[feature];
|
||||||
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`Failed to query feature flag ${feature} (see error below)`);
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user