Skip to content

SCAL-336941 add UpdateTheme host event - #697

Open
harshitbhardwaj-ts wants to merge 1 commit into
mainfrom
SCAL-336941
Open

harshitbhardwaj-ts wants to merge 1 commit into
mainfrom
SCAL-336941

Conversation

@harshitbhardwaj-ts

Copy link
Copy Markdown
Collaborator

Summary

Adds HostEvent.UpdateTheme, which switches an open embed between dark appearance and its default appearance without reloading it. Follows the isDarkMode option from #672.

await embed.trigger(HostEvent.UpdateTheme, { isDarkMode: true });

Changes

  • HostEvent.UpdateTheme (wire value 'UpdateTheme') with payload
    UpdateThemeRequest { isDarkMode: boolean }. It is typed in
    HostEventRequestMap, exported from the package and the React entry, and
    added to the contract guardrail lists.
  • Resolves with the applied value, for example { isDarkMode: true }. When
    dark appearance is not available in the embed, the embed does not change and
    the promise rejects with an error message.
  • After a successful switch, trigger() stores the value in
    viewConfig.isDarkMode. A later render or pre-render show then sends it
    instead of the value the embed loaded with.

Testing

  • 3 unit tests in ts-embed.spec.ts: the reply, the kept appearance, and the rejection.
  • Full suite, type-check and size check pass (32.31 kB of 34 kB).
  • Tested end to end in a local developer playground.

@harshitbhardwaj-ts
harshitbhardwaj-ts requested a review from a team as a code owner October 1, 2026 17:37

@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 introduces the HostEvent.UpdateTheme event, allowing the embed to switch between dark appearance and its default appearance dynamically without reloading. It adds the UpdateThemeRequest interface, updates the HostEventRequestMap, handles the event in TsEmbed to persist the applied theme state in viewConfig.isDarkMode, and exports the new types. Comprehensive unit tests and JSDoc documentation with examples have also been added. There are no review comments, and we have no feedback to provide.

@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 448a52c

This branch has not been deployed

No deployments
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.

1 participant