SCAL-334713 Deserialize URL-encoded params in UpdateEmbedParams payload - #647
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where dataSources is passed as a JSON-encoded string instead of an array in getUpdateEmbedParamsObject, causing GraphQL coercion failures. It adds parsing logic to convert the string back to an array, introduces a deprecation warning for SearchViewConfig.dataSources in favor of dataSource, and includes corresponding unit tests. The review feedback suggests making the dataSources parsing more robust by handling non-array parsed values and raw, unquoted GUIDs to prevent potential runtime errors.
commit: |
sastaachar
previously approved these changes
Sep 1, 2026
Blanket decodeURIComponent could mangle raw string params that legitimately contain %xx sequences (they were never URL-encoded in the event payload). Keep only JSON.parse-with-fallback, which is the exact inverse of serializeParam and all the reported bug needs.
sastaachar
approved these changes
Sep 1, 2026
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.
The UpdateEmbedParams payload was built by the URL serializer but delivered as a postMessage — so values like dataSources arrived as JSON-encoded strings that the app stores unparsed, while the same values from an actual URL load get parsed on boot. This change adds deserializeParam (the previously-missing inverse of serializeParam) and applies it to the payload, guaranteeing the event delivers exactly what a URL load would — fixing the $sources GUID coercion failure (SCAL-334713) and the latent searchTokenString double-encoding with one mechanism instead of per-field patches.