diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b89dea..d058d8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 3.9.6 +- Fixed issue with fallback attribute ignoring when needed. + # 3.9.5 - Add subscription logic - Fix issue with null handling diff --git a/lib/src/Utils/gb_utils.dart b/lib/src/Utils/gb_utils.dart index 6bec298..0ef742a 100644 --- a/lib/src/Utils/gb_utils.dart +++ b/lib/src/Utils/gb_utils.dart @@ -374,8 +374,8 @@ class GBUtils { // Retrieve fallbackAttributeAndValue and fallbackKey final fallbackAttributeAndValue = getHashAttribute( context: context, - attr: null, - fallback: expFallBackAttribute, + attr: expFallBackAttribute, + fallback: null, attributeOverrides: attributeOverrides, ); diff --git a/pubspec.yaml b/pubspec.yaml index 59677f6..0470c6d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: growthbook_sdk_flutter description: An open-source feature flagging and experimentation platform that makes it simple to alter features and execute A/B testing. -version: 3.9.5 +version: 3.9.6 homepage: https://github.com/alippo-com/GrowthBook-SDK-Flutter repository: https://github.com/growthbook/growthbook-flutter diff --git a/test/test_cases/test_case.dart b/test/test_cases/test_case.dart index c52b53f..76b0008 100644 --- a/test/test_cases/test_case.dart +++ b/test/test_cases/test_case.dart @@ -7715,6 +7715,72 @@ const String gbTestCases = r''' } } ], + [ + "upgrades a sticky bucket doc from a fallbackAttribute to a hashAttribute", + { + "attributes": { + "id": "i123", + "anonymousId": "ses123", + "foo": "bar", + "country": "USA" + }, + "features": { + "exp1": { + "defaultValue": "control", + "rules": [ + { + "key": "feature-exp", + "seed": "feature-exp", + "hashAttribute": "id", + "fallbackAttribute": "anonymousId", + "hashVersion": 2, + "bucketVersion": 0, + "condition": { "country": "USA" }, + "variations": ["control", "red", "blue"], + "meta": [{ "key": "0" }, { "key": "1" }, { "key": "2" }], + "coverage": 1, + "weights": [0.3334, 0.3333, 0.3333], + "phase": "0" + } + ] + } + } + }, + [ + { + "attributeName": "anonymousId", + "attributeValue": "ses123", + "assignments": { + "feature-exp__0": "1" + } + } + ], + "exp1", + { + "bucket": 0.9943, + "featureId": "exp1", + "hashAttribute": "id", + "hashUsed": true, + "hashValue": "i123", + "inExperiment": true, + "key": "1", + "stickyBucketUsed": true, + "value": "red", + "variationId": 1 + }, + { + "anonymousId||ses123": { + "assignments": { "feature-exp__0": "1" }, + "attributeName": "anonymousId", + "attributeValue": "ses123" + }, + "id||i123": { + "assignments": { "feature-exp__0": "1" }, + "attributeName": "id", + "attributeValue": "i123" + } + } + ], [ "favors a sticky bucket doc based on hashAttribute over fallbackAttribute", {