Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Draft Feature Flags

Flarnie Marchan edited this page Jul 14, 2017 · 1 revision

Draft.js is widely used in Facebook products and we often set changes on a small group of users before releasing them to everyone.

In order to gate a change to only affect a small group of users, we use feature flags. To add a feature flag to your PR, please do the following:

  1. Add a string to DraftFeatureFlags.js and set it to 'false'.
  2. Wrap your changes in a conditional that references the variable from DraftFeatureFlags. Here is an example:
var DraftFeatureFlags = require('DraftFeatureFlags');
// ...
// call it something unique and descriptive, please *not* "my_draft_feature_flag"
if (DraftFeatureFlags.my_draft_feature_flag) {
  // do the new behavior
} else {
  // do the old behavior
}
Clone this wiki locally