feat(base/flags): add warning for unsupported feature flags

This commit is contained in:
Calin-Teodor
2025-09-25 15:43:16 +03:00
committed by Calinteodor
parent 753d0399c9
commit 40b8d6168b

View File

@@ -1,4 +1,7 @@
import logger from '../app/logger';
import { UPDATE_FLAGS } from './actionTypes'; import { UPDATE_FLAGS } from './actionTypes';
import * as featureFlags from './constants';
/** /**
* Updates the current features flags with the given ones. They will be merged. * Updates the current features flags with the given ones. They will be merged.
@@ -10,6 +13,13 @@ import { UPDATE_FLAGS } from './actionTypes';
* }} * }}
*/ */
export function updateFlags(flags: Object) { export function updateFlags(flags: Object) {
const supportedFlags = Object.values(featureFlags);
const unsupportedFlags = Object.keys(flags).filter(flag => !supportedFlags.includes(flag as any));
if (unsupportedFlags.length > 0) {
logger.warn(`The following feature flags are not supported: ${unsupportedFlags.join(', ')}.`);
}
return { return {
type: UPDATE_FLAGS, type: UPDATE_FLAGS,
flags flags