Repository navigation
feat: add updateAttributes to merge into the existing attributes - #188
Open
vazarkevych wants to merge 1 commit into
Open
vazarkevych wants to merge 1 commit into
vazarkevych wants to merge 1 commit into
Conversation
This was referenced Oct 20, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
updateAttributes/updateAttributesAsync, which merge into the existing attributes instead of replacing them. Split out of #176 (section 1).setAttributes/setAttributesAsyncupdateAttributes/updateAttributesAsyncWhy: adding one attribute (e.g. after login) meant rebuilding the whole map, and a key left out was silently dropped.
Behavior
Same as
updateAttributesin the JS SDK (GrowthBook.ts): a shallow merge, then the regularsetAttributespath. So sticky bucket refresh and, in remote-eval mode, the fresh evaluation from #187 apply unchanged; the async variant awaits both.nullvalue is stored asnull; it does not remove the key.setAttributesnow documents that it is a full replace and points toupdateAttributes.Compatibility
Additive only: no existing API or behavior changes.
Test plan
gb_sdk_attributes_test.dart: merge, overwrite, merge vs replace, empty map,nullvalues, shallow merge, bucketing on merged attributes, caller's Map untouched, accumulation, async variant, sticky bucket refresh awaited. 2 ingb_sdk_remote_eval_test.dart: the remote-eval POST carries the merged attributes, for both variants.dart analyze --fatal-infos,dart formatandflutter test(3 runs) clean.updateAttributes({'country': 'UA'})sent a POST with{id, country}, kept theid-based experiment assignment, and a later published change still arrived through the stream with the merged attributes.