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
fix: support to get states of multiple feature flags #2471
base: main
Are you sure you want to change the base?
Conversation
@@ -13,6 +13,16 @@ export abstract class FeatureStateResolver { | |||
); | |||
} | |||
|
|||
public getFeatureStates(features: string[]): Observable<Map<string, FeatureState>> { |
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.
how does this differ from the existing function right below this getCombinedFeatureState ? If you want multiple values and are working with them independently, make multiple calls. If you're resolving them together, use the existing merger
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.
we want multiple values, i.e., separate states of each FF, but want to use them in the same place like
FF1 === Enabled ? returnSomething1() : returnNothing1();
FF2 === Enabled ? returnSomething2() : returnNothing2();
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.
Why not get each individually then?
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.
So I thought having these methods in each service, let's common them out in this service
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.
What is there in common there though? You're taking two different actions based on two different FFs, so how does the map help?
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.
like we could call a method to get the states of all these FFs, and use them inside the pipe
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 we really want this, it's not a huge deal - just not sure we're providing a lot of value. the difference between (pseudo)
combineLatest(resolver.getState(first), resolver.getState(second))
and resolver.getStates(first, second)
just doesn't seem worth adding a dedicated API for. In either case, you're likely going to be writing extraction code to reshape it right after.
Codecov Report
@@ Coverage Diff @@
## main #2471 +/- ##
==========================================
- Coverage 83.02% 83.00% -0.02%
==========================================
Files 916 916
Lines 20474 20480 +6
Branches 3238 3238
==========================================
+ Hits 16999 17000 +1
- Misses 3356 3361 +5
Partials 119 119
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Unit Test Results 4 files 309 suites 52m 20s ⏱️ Results for commit 7c3ea60. |
No description provided.