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

Merge Attributes on Override Attributes and/or Pass User Attributes as Context #120

Open
dtothefp opened this issue Aug 6, 2021 · 2 comments

Comments

@dtothefp
Copy link

dtothefp commented Aug 6, 2021

We have a base set of attributes that are passed to our OptimizelyProvider upon initialization. A common use case is in a hook to pass the overrideAttributes. Generally we would like to have our base attributes merged with the overrideAttributes. It looks like the OptimizelyProvider uses the .setUser method and then in the hook calls .activate with the third argument of the override attributes. I'm under the impression that this will completely override our base set of attributes.

Currently, if we pass overrides we have to access our base attributes from state or context and manually merge them in the hook. I would be nice if they were passed as context and either the hook merges them internally or we can use the Optimizely context to access the base attributes and perform the merge with overrides.

@Tamara-Barum
Copy link

Internal ticket: [FSSDK-8652]

@junaed-optimizely
Copy link
Contributor

junaed-optimizely commented Jul 2, 2024

Hey @dtothefp, it's been a while. I'm going through old issues and found this one. Do you still need it reviewed?

From what I remember, overrideUserAttributes is meant to completely replace the attribute object, not merge it with the base attributes. If a developer wants to merge them, they can.
Also, merging in the SDK layer could introduce new problem, like not being able to unset base attributes.

Let me know your thoughts on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants