Skip to content

Commit

Permalink
Fixed incorrect implementation of GetFeatureResult call
Browse files Browse the repository at this point in the history
  • Loading branch information
Norhaven committed Feb 3, 2024
1 parent 39e19fe commit ae98ce0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.2]

- Fixed issue with incorrect logic in GrowthBook.GetFeatureResult<T>() call.

## [1.0.1]

- Fixed issue with empty string value sent to IsIn condition evaluation.
Expand Down
9 changes: 3 additions & 6 deletions GrowthBook/GrowthBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,9 @@ public bool IsOff(string key)
/// <inheritdoc />
public T GetFeatureValue<T>(string key, T fallback)
{
FeatureResult result = EvalFeature(key);
if (result.On)
{
return result.Value.ToObject<T>();
}
return fallback;
var value = EvalFeature(key).Value;

return value.IsNull() ? fallback : value.ToObject<T>();
}

/// <inheritdoc />
Expand Down
2 changes: 1 addition & 1 deletion GrowthBook/GrowthBook.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/growthbook/growthbook-csharp.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>GrowthBook,A/B test,feature toggle,flag</PackageTags>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<Title>GrowthBook C# SDK</Title>
<PackageProjectUrl>https://www.growthbook.io/</PackageProjectUrl>
</PropertyGroup>
Expand Down

0 comments on commit ae98ce0

Please sign in to comment.