-
Notifications
You must be signed in to change notification settings - Fork 53
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
WithVariantFallback and WithVariantFallbackFunc are called when feature isn't found #160
Comments
I've done some digging, some comparing with other SDKs, and you're completely right 🙌🏼 The issue here is with the implementation. The fallback should be used when there is no flag, when the flag doesn't have any variants, and if the flag has variants, but is disabled. If you feel like you wanna tackle this too, then we'd be very happy to review the PR when it comes through. If not, we'll pencil it in and probably get to fixing this early next week (depending on other incoming tasks). |
I do believe this would resolve our issue. Thanks!
I didn't have any time today and my Monday is already booked. I'll post next week if Tuesday is better. |
No worries! This was at the top of our pile today, so I got a PR up #171 that I believe should fix this 😄 |
This PR fixes a bug in how we use fallback variants in this SDK. The fallback should be used when there is no flag, when the flag doesn't have any variants, and if the flag has variants, but is disabled. However, prior to this, it was only used if the flag didn't exist. It addresses the issues in and closes #160. * fix: add tests and impl * fix: update comments * fix: minor rename * fix: use noopListener * fix: don't change the "FeatureEnabled" state of the fallback variant * Chore: remove empty struct from list * Test: ensure that the fallback variant's `FeatureEnabled` is unchanged * Docs: add notes about `FeatureEnabled` to function docs
Describe the bug
WithVariantFallback and WithVariantFallbackFunc both say they are called when no variant is found but they're actually called when a feature isn't found. There's no way to provide a fallback when variants aren't found.
Steps to reproduce the bug
GetVariant
on a non-existent feature withWithVariantFallback
.Expected behavior
I expected the options to match their descriptions and only be called when the variant isn't found.
Logs, error output, etc.
No response
Screenshots
No response
Additional context
No response
Unleash version
No response
Subscription type
Pro
Hosting type
Hosted by Unleash
SDK information (language and version)
Version 4.0.1
The text was updated successfully, but these errors were encountered: