-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to override feature flags with environment variable FEATURE_FLAGS #1372
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 571ca9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportBase: 47.61% // Head: 43.01% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #1372 +/- ##
===========================================
- Coverage 47.61% 43.01% -4.61%
===========================================
Files 687 609 -78
Lines 30258 25477 -4781
Branches 7912 6979 -933
===========================================
- Hits 14407 10958 -3449
+ Misses 14632 13385 -1247
+ Partials 1219 1134 -85
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Screenshots: ✅
There are no changes in the screenshots for this PR. If this is expected, you are good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some feedback. good overall.
if (feature) | ||
return { | ||
...feature, | ||
overridesRemote: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's overriden by env, should remove be false? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still overrides the remote value, if the name of the variable was different I would have done what you are suggesting
{focusedName === flagName ? ( | ||
<Flex flexDirection="column" pl={6} rowGap={3}> | ||
<EditSection | ||
value={inputValues[flagName] || JSON.stringify(pureValue)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer to cache this with a memo. stringify
every time it re-renders isn't ideal. you may want to have an intermediary component to ease this as it's included in a "if", generally speaking the JSX tree is quite deep here and splitting into more components isn't bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I'll do that 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👌
I split it in 3 components on both LLM & LLD -> FeatureFlagsSettings/index.tsx
FeatureFlagDetails.tsx
FeatureFlagEdit.tsx
.
It's much clearer now I think
Screenshots: ✅
There are no changes in the screenshots for this PR. If this is expected, you are good to go. |
Add feature flags parameter to playwright test fixtures doc:ljs Add env overriding of feature flags in LLM changesets Fix FeatureFlagsButton LLD Fix FeatureFlagsButton remove console log Refactor feature flag settings on LLD Add null to JSONValue type Refactor FeatureFlagsSettings (split in components) Move LLD's FeatureFlagEdit to own component Apply switch toggle directly rather than just modifying the input Remove useless badly typed tryParse
…tically set flag keys
60ae08a
to
e1aefef
Compare
Force push: just a squash & rebase, then did some fixes on both apps |
📝 Description
I did this because I needed to set a feature flag in a playwright test and doing it through an env variable made sense as playwright fixtures are already modifying
env
.Now in playwright you can do this to enabled a feature flag:
It is working both on LLM and LLD.
I also made the appropriate changes in the feature flag debugging UIs in both LLM and LLD.
I'm sure this will be useful in the future for other purposes.
❓ Context
ledger-live-mobile
ledger-live-desktop
types-live
live-common
✅ Checklist
📸 Demo
Compiling LLM with
.env
file inapps/ledger-live-mobile
:Running LLD like this
FEATURE_FLAGS='{"mockFeature": {"enabled": false, "someRandomKey": "aCustomValue"}}' pnpm dev:lld
🚀 Expectations to reach
Please make sure you follow these Important Steps.
Pull Requests must pass the CI and be internally validated in order to be merged.