We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
false
nil
Given a super simple feature defition:
{"defaultValue"=>false}
The SDK returns nil when checking its value, reproduction code:
features = {"simple_feature" => {"defaultValue" => false}} gb = Growthbook::Context.new(features: features) gb.on?("simple_feature") #=> false gb.feature_value("simple_feature") #=> nil
Is this expected behaviour? The offending code is here: https://github.com/growthbook/growthbook-ruby/blob/main/lib/growthbook/context.rb#L137
Which I think is incorrect since: false || nil in Ruby will always yield nil. I think what author meant to write was:
false || nil
feature.default_value.nil? ? nil : feature.default_value
I also tested the behaviour with JS SDK and it does return false as expected:
gb.loadFeatures({ autoRefresh: true }).then(function() { gb.getFeatureValue('simple_feature'); // => false });
The text was updated successfully, but these errors were encountered:
I can provide a PR with a fix if needed and you confirm this to be an issue :)
Sorry, something went wrong.
Thanks for catching this. A PR would be great!
PR here
Merge pull request #21 from Rabshab/20-default-value-bug
77c5ca4
Fix Issue #20: default value bug
Successfully merging a pull request may close this issue.
Given a super simple feature defition:
The SDK returns
nil
when checking its value, reproduction code:Is this expected behaviour? The offending code is here: https://github.com/growthbook/growthbook-ruby/blob/main/lib/growthbook/context.rb#L137
Which I think is incorrect since:
false || nil
in Ruby will always yieldnil
. I think what author meant to write was:I also tested the behaviour with JS SDK and it does return
false
as expected:The text was updated successfully, but these errors were encountered: