Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Greedy-Geek
Copy link
Contributor

No description provided.

@Greedy-Geek Greedy-Geek requested a review from a team as a code owner October 17, 2023 16:31
@@ -13,6 +13,16 @@ export abstract class FeatureStateResolver {
);
}

public getFeatureStates(features: string[]): Observable<Map<string, FeatureState>> {
Copy link
Contributor

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

Copy link
Contributor Author

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();

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #2471 (7c3ea60) into main (2c52154) will decrease coverage by 0.02%.
The diff coverage is 16.66%.

@@            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              
Files Coverage Δ
...common/src/feature/state/feature-state.resolver.ts 52.17% <16.66%> (-12.54%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

Unit Test Results

       4 files     309 suites   52m 20s ⏱️
1 122 tests 1 122 ✔️ 0 💤 0 ❌
1 132 runs  1 132 ✔️ 0 💤 0 ❌

Results for commit 7c3ea60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants