Skip to content

[BUG] dark/light mode switch has no effect, sending incorrect variables to MCP Apps #1982

@mdodell

Description

@mdodell

Issue

Toggling dark mode in Settings has no effect on hostContext.theme or the style variables sent to MCP apps — they always resolve to "light".

How to reproduce

  1. Open the Inspector
  2. Navigate to the Playground and start a chat with an MCP app that renders a widget
  3. Go to Settings and toggle "Dark Mode" on
  4. Return to the Playground and inspect result.hostContext.theme in the widget debug panel — it is still "light" and the style variables remain light-mode values

Expected Behavior

When dark mode is toggled on, result.hostContext.theme should be "dark" and hostContext.styles.variables should contain the dark-mode design tokens.

Screenshots

N/A

Platform

  • Mac

Additional Context

Theme had two competing sources of truth: themeMode in the preferences store (set by the Settings toggle) and draftHostContext.theme in the host context store (baked in by buildDefaultWorkspaceHostContext). When the global theme changed, loadWorkspaceHostContext silently skipped the update whenever the host context was dirty or a saved workspace config existed. The stale draftHostContext.theme then won the resolution chain in both PlaygroundMain and MCPAppsRenderer.

Other host context fields (locale, timezone, device capabilities) were unaffected because they only flow through patchHostContext — no competing global preference store.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions