Skip to content

Fix charts and expired sessions, stop the double embed load, add dark mode, pinning and Intel builds - #5

Merged
flopitaux-ts merged 10 commits into
mainfrom
fix-charts-and-embed-reload
Oct 19, 2026
Merged

flopitaux-ts merged 10 commits into
mainfrom
fix-charts-and-embed-reload

Conversation

@flopitaux-ts

@flopitaux-ts flopitaux-ts commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Spotter answers showed "Cannot display the chart" in the desktop app, even though the same answers render fine in a browser. While tracking that down, I found that the embed was also loading twice on every launch.

What changed

Each item is its own commit, so the PR can be reviewed one commit at a time.

Fixes

  • Charts render again. ThoughtSpot draws charts in an iframe on its chart host (hc-advanced.pdom.thoughtspot.com), which sends frame-ancestors *. In CSP, * only matches network schemes, so the file:// page the renderer runs on is never an allowed ancestor, and Chromium blocks the frame. For subframes on other origins, the app now drops frame-ancestors only when its sources include *. That case fails here only because * doesn't match file://, and a browser would allow it. A policy that names its ancestors is a real refusal and is left alone, as is X-Frame-Options alongside it. My first version stripped the directive from every cross-origin subframe, which let Okta's sign-in form render inside the embed; a follow-up commit fixes that. Header names are now matched case-insensitively.

  • The embed loads once per launch, not twice. The SDK's React wrapper deep-compares its listeners, and when any of them changes identity it destroys and rebuilds the iframe. The handler maps were rebuilt on every render, so each launch threw away a half-loaded ThoughtSpot (25–41 aborted CDN requests), and any later re-render would have wiped the conversation on screen. The handler maps are now memoized.

  • Expired sessions go back to sign-in instead of a broken embed. With AuthType.None the SDK reports success without checking anything, and it swallows auth failures. So an expired session skipped sign-in at launch, the embed was sent to the identity provider (which either refused to be framed or showed an error), and loggedIn stayed set across relaunches. Now:

    • At launch, the app checks /callosum/v1/session/isactive before skipping sign-in. If the cluster can't be reached, the user stays signed in: offline is not signed out.
    • The embed frame is stopped from navigating off the ThoughtSpot origin, and that counts as an expiry. Nested chart frames aren't affected.
    • The app also listens for the embed's AuthFailure, AuthExpire and IdleSessionTimeout events.
    • The sign-in screen comes back with a notice saying the session expired, and Session Expired is tracked with the signal that caught it. Signing out and switching instance aren't reported as expiry.

Upgrades: Visual Embed SDK 1.52.0 → 1.53.1, Electron 44.4.1 → 44.9.0.

Enhancements

  • Pinned conversations in the sidebar (spotterChatPinConfig, 26.10+; older clusters ignore it).
  • Background update checks: every 6 hours, and 30 seconds after the Mac wakes. Each version is announced once, so a dismissed banner doesn't keep coming back.
  • Dark theme for the app's own screens and the sign-in splash, following the macOS appearance. The native window background follows too, so there's no white flash. Letting the host set the embed's theme (isDarkMode, HostEvent.UpdateTheme) needs ThoughtSpot 26.12, so for now the embed keeps following the system appearance.
  • Intel builds: DMG and zip now build for both arm64 and x64. Until now, releases were Apple Silicon only.
  • Removed the unused playwright-core dependency.

Testing

Tested on the dev build against champagne.thoughtspotstaging.cloud (26.11):

  • Charts: before the fix, Chromium logged a frame-ancestors violation and the chart showed the error. After it, the chart iframe completes its InitializeComplete handshake and renders. Re-checked after the SDK/Electron upgrade.
  • Embed loads: 1 embed load and 0 aborted requests per launch, down from 2 loads and 25–41 aborts.
  • Dark theme: light and dark screenshots taken by toggling nativeTheme.themeSource.
  • Session expiry: tested on a copy of the profile with the ThoughtSpot cookies removed, both at launch and mid-session. Before the fix, Okta's username/password form rendered inside the embed at launch, and an identity-provider error page showed mid-session. After it, both cases land on the sign-in screen with the notice, and loggedIn is cleared. A valid session stays signed in.
  • Charts after the framing change: a bar-chart answer rendered through the chart host (8 SVGs, with account names on the axis).
  • Packaging: packaged both arm64 and x64 with electron-builder --dir; the binaries are the right architecture.
  • npm run lint and the production webpack build pass.

Not verified:

  • The Pin item in the sidebar's conversation menu. I confirmed the SDK passes the setting to the embed, but haven't looked at the menu.
  • The 6-hour and on-wake update checks haven't fired live. A dev build only uses the GitHub fallback.
  • The release workflow now builds and notarizes two architectures, so expect it to take longer.

🤖 Generated with Claude Code

Francois Lopitaux and others added 10 commits October 19, 2026 10:50
ThoughtSpot draws charts in an iframe on its own chart host, which sends
`frame-ancestors *`. In CSP, `*` only matches network schemes, so the
file:// page the renderer runs on is never an allowed ancestor and
Chromium blocks the frame. The embed then shows "Cannot display the
chart", while the same answer renders fine in a browser.

For subframes on other origins, drop only frame-ancestors and
X-Frame-Options and keep the rest of their policy. Header names are now
matched case-insensitively instead of by listing spellings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK's React wrapper deep-compares its listeners, and when any of them
changes identity it destroys the iframe and builds a new one. The handler
maps were rebuilt on every render, and mergeHandlers made new wrappers
too, so once auth and Orgs settled the app threw away a half-loaded
ThoughtSpot and started over. Each launch aborted 25-41 CDN requests. A
later re-render would also wipe the conversation on screen.

Memoize each hook's handler map and the merged result. The embed now
loads once and nothing is aborted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in the app, its build or CI imports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Native Spotter ships pinning on, but embeds have it off unless spotterChatPinConfig asks for it (26.10+). Older clusters ignore the setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The only check ran at launch, so a dock app left open for days sat on an old build. Check every six hours, and 30 seconds after wake, since a long sleep has most likely skipped one. Each version is announced once, so a dismissed banner does not keep coming back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app's own screens were light only, while the embedded Spotter follows the system appearance, so dark-mode users got a white flash at launch and a mismatched frame. Add dark tokens for the app and the sign-in splash, and make the native window background follow the appearance too, since it shows through on resize and reload.

Setting the embed's theme from the host (isDarkMode, HostEvent.UpdateTheme) needs ThoughtSpot 26.12, so the embed keeps following the system for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Releases were arm64 only, so Intel Macs could not run them. electron-updater picks the zip that matches the running Mac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The chart fix dropped frame-ancestors and X-Frame-Options from every cross-origin subframe. That also stripped the identity provider's protection: Okta sends frame-ancestors with an explicit host list, and once a session expired its username and password form rendered inside the embed, with no address bar showing whose page it was. On main, Chromium blocked it.

Drop the directive only when its sources include *. That case fails here only because * does not match the file:// top page, and a browser would allow it. X-Frame-Options goes only alongside a dropped wildcard, since CSP takes precedence over it. Charts still render through the chart host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The persisted loggedIn flag was trusted on launch, and with AuthType.None the SDK reports success without checking anything, so an expired session skipped sign-in. ThoughtSpot then sent the embed to the identity provider, which either refused to be framed or failed with an error. Mid-use expiry ended the same way: the SDK swallows auth failures for AuthType.None, so onAuthLost never ran, and the flag stayed set across relaunches.

- On launch, check /callosum/v1/session/isactive on the embed's cookie jar before skipping sign-in. If the cluster can't be reached, keep the user signed in: offline is not signed out.
- Stop the embed frame from navigating off the ThoughtSpot origin and treat that as an expiry. Nested chart frames are not affected.
- Also listen for the embed's AuthFailure, AuthExpire and IdleSessionTimeout events.
- Return to the sign-in screen with a notice saying the session expired, and track Session Expired with the signal that caught it. Signing out and switching instance are not reported as expiry.

Verified on a copy of the profile with the ThoughtSpot cookies removed, at launch and mid-session. A valid session stays signed in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flopitaux-ts flopitaux-ts changed the title Fix charts not rendering, stop the double embed load, and add dark mode, pinning and Intel builds Fix charts and expired sessions, stop the double embed load, add dark mode, pinning and Intel builds Oct 19, 2026
@flopitaux-ts
flopitaux-ts merged commit 9bb7d39 into main Oct 19, 2026
4 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.

1 participant