Feature Flag best practices #1375
Replies: 6 comments
-
Copy existing codeThe following code initializes the Launch Darkly library and provides two helpful functions:
https://github.com/bcgov/business-filings-ui/blob/main/src/utils/feature-flags.ts |
Beta Was this translation helpful? Give feedback.
-
Use local default/failsafe flag valuesYour app needs to work "safely" if the feature flags cannot be fetched from Launch Darkly. |
Beta Was this translation helpful? Give feedback.
-
Sample boolean flagLD config: UI code:
Note the use of |
Beta Was this translation helpful? Give feedback.
-
Sample array flagLD config: UI code:
Note the use of |
Beta Was this translation helpful? Give feedback.
-
TargetingThis feature allows some users to see one variation of a feature flag (eg, ON) while remaining users see another variatio of a flag (eg, OFF). This can be configured using a simple targeting rule (eg, a list of emails) or using a segment (eg, a list of users). Note
|
Beta Was this translation helpful? Give feedback.
-
Enabling a FF that uses targeting rules"Targeting" and "whether the flag is enabled or disabled" are the same thing, therefore if you turn off targeting then you are disabling the flag, and if you turn on the flag then you are enabling targeting (with whatever rules are in place, such as certain emails only). THEREFORE, to enable the flag for all users, all rules have to be deleted. |
Beta Was this translation helpful? Give feedback.
-
Best practices and lessons learned during use of feature flags in UIs...
Please add a comment for each new item, so that replies can be threaded.
Copy existing code
Use local default/failsafe values
Sample boolean flag
Sample array flag
Targeting
Enabling a FF that uses targeting rules
Beta Was this translation helpful? Give feedback.
All reactions