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: isFeatureEnabled wasn't sending the $feature_flag_called event #185

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

marandaneto
Copy link
Member

💡 Motivation and Context

Closes https://posthoghelp.zendesk.com/agent/tickets/18551

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

@marandaneto marandaneto changed the title add test fix: isFeatureEnabled wasn't sending the $feature_flag_called event Sep 26, 2024
@marandaneto marandaneto requested a review from a team September 26, 2024 10:39
@marandaneto marandaneto marked this pull request as ready for review September 26, 2024 10:39
@@ -692,18 +692,17 @@ public class PostHog private constructor(
if (!isEnabled()) {
return defaultValue
}
return featureFlags?.isFeatureEnabled(key, defaultValue) ?: defaultValue
val value = featureFlags?.isFeatureEnabled(key, defaultValue) ?: defaultValue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in most SDKs isFeatureEnabled calls getFeatureFlag, so all of this handling can be in one place. Think we can do the same here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because of this tiny bit of code its trickier

return if (value != null) {
if (value is Boolean) {
value
} else {
// if its multivariant flag, its enabled by default
true
}
} else {
defaultValue
}

since this is a compiled language and it has strongly typed methods, will get it merged for now and think if its worth the refactoring 🧐

@marandaneto marandaneto merged commit b064102 into main Sep 26, 2024
5 checks passed
@marandaneto marandaneto deleted the fix/isFeatureEnabled-ff-called branch September 26, 2024 11:41
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.

2 participants