-
Notifications
You must be signed in to change notification settings - Fork 11
Features
Features are settings located in features.json. These settings are used by build variants to check for feature toggles and certain variables such as the document.title text in the application.
To add a feature, create a new entry into features.json (including all build variants). This means we add a new entry into all variants of features.json in folders ./src/__viteBuildVariants__/[variant].
Then to be able to reference the feature in the Feature enum in file FeatureToggles.ts. The name should string variant should reflect the name in features.json.
We can use features specified in features.json by using the utility file FeatureToggles.ts
document.title = getFeature(Feature.TITLE);
// Or
console.log(hasFeature(Feature.KNN_MODEL);
Feature flags are strings that can be placed in the browser's cookies to change how the system behaves. To enable features that are behind feature flags, create a cookie on the domain you wish to test on, named fflags
. Then create a comma-separated list of the features you wish to enable.
Feature flags are used for in-development feature testing in production. This means it is subject to frequent change and undefined behaviours.
-
FEATURE-TOGGLE-ALWAYS-TRUE
- Forcefully set features in features.json to true at runtime. Features toggles in the features.json, such as KNN_MODEL will now always be set to true, despite it's configuration value.
example value of fflags FEATURE-TOGGLE-ALWAYS-TRUE
Using chromium-based browsers,
- Open the developer tools
- Navigate to Application tab
- Open the cookies expandable menu under storage
- Create a cookie named fflags
- Assign the feature flag values you want, comma-separated
- (optionally) It is recommended to set an expiration date as it will default to the current session.