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

getFeatureFlags on ConfigurationMapFeatureFlagProvider fails - Treats array as single object #74

Open
strickie opened this issue Dec 18, 2024 · 5 comments
Assignees

Comments

@strickie
Copy link

When calling getFeatureFlags on ConfigurationMapFeatureFlagProvider the call fails becaus the code call treats array as single object

In

export function validateFeatureFlag(featureFlag: any): void {

In featureProvider.ts

async getFeatureFlag(featureName: string): Promise<FeatureFlag | undefined> {

The same validateFeatureFlag function is called with both a single FeatureFlag and array of FeatureFlag but the function doesn't handle arrays.

Image

@vputsenko
Copy link

vputsenko commented Dec 18, 2024

Facing with same issue. FEATURE_FLAGS_KEY contains not a single feature flag but array of feature flags so it is incorrect to call this function for this array.

Image

Interesting how typescript compiled this code ) look like validateFeatureFlag. in source code we have
export function validateFeatureFlag(featureFlag: any): void

that "any" wad written to avoid casts inside validateFeatureFlag function. However you can write validateFeatureFlag(flag: Partial< FeatureFlag >) and achieve same effect but get this error covered by compiler.

@zhiyuanliang-ms
Copy link
Contributor

Hey, @strickie @vputsenko Sorry for the late response. Looking into the issue.

@zhiyuanliang-ms
Copy link
Contributor

@vputsenko @strickie Sorry for the mistake. This is a bad bug. I didn't notice it during the code review. My fault. Sorry, orz
BTW, we didn't have testcases for getFeatureFlags. That is a huge oversight. I will add testcase for it and fix the bug immediately.

We added this in 2.0.0-preview.3. Other packages before it should be fine. I will publish a bug fix release very soon. Sorry for the inconvenience.

@zhiyuanliang-ms
Copy link
Contributor

#78

@vputsenko
Copy link

Great, Thank you!

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

No branches or pull requests

3 participants