Skip to content

SCAL-334713 Deserialize URL-encoded params in UpdateEmbedParams payload - #647

Merged
yinstardev merged 4 commits into
mainfrom
SCAL-334713
Sep 1, 2026
Merged

SCAL-334713 Deserialize URL-encoded params in UpdateEmbedParams payload#647
yinstardev merged 4 commits into
mainfrom
SCAL-334713

Conversation

@yinstardev

@yinstardev yinstardev commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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.

@yinstardev
yinstardev requested a review from a team as a code owner September 1, 2026 03:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/embed/ts-embed.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@thoughtspot/visual-embed-sdk@647

commit: 5e980da

@yinstardev yinstardev changed the title SCAL-334713 test-fix SCAL-334713 Deserialize URL-encoded params in UpdateEmbedParams payload Sep 1, 2026
sastaachar
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.
@yinstardev
yinstardev merged commit b29014a into main Sep 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants