-
Notifications
You must be signed in to change notification settings - Fork 57
fix: add check for arrays in hashAttributes #1147
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
Closed
jaissica12
wants to merge
4
commits into
development
from
fix/SDKE-845-handle-arrays-in-hashAttributes
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaissica12
what happens when you call hashAttributes on a value that's an arry using the Rokt SDK? we want to make sure the behavior is the same. something to flag to Matt if it's doing it improperly there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmi22186 In Rokt SDK when an array is passed for hashing, it is converted to a string using JavaScript String() coercion, which joins array elements with commas and then hashes them.
Example:
@mattbodle So as of now, both the Core SDK and the Rokt SDK allow hashing of arrays by implicitly converting them to strings. I’ve created this PR in core sdk to skip hashing when the value is an array.
Do we want to officially support hashing arrays, given that it currently just converts the array to a comma-separated string before hashing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaissica12 IMO, while I see why you are doing this, the more important thing isn't having an array that ends up being hashed - the end result is that the final hashed string is consistent. whether it's hashing ['a', 'b', 'c'], or 'a,b,c' doesn't matter in the use case.
If we change this now, it would change behavior of the wSDK's customers to have a different final hashed string fro before and after the change, so I'd personally reject this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand what you’re saying. My thinking was around the value of hashing an array, but I agree that the priority here is keeping the final hashed output consistent for existing wSDK customers. Since changing this would alter behavior, I’m aligned with rejecting the PR and will go ahead and close it.