Skip to content

Commit fc162bb

Browse files
cliffhallclaude
andcommitted
docs(apps): clarify theme attribute + useSandboxUrl fetch comments
Re-review follow-ups (non-blocking): - createAppBridgeFactory: note that Mantine's data-mantine-color-scheme is only ever light/dark (auto is resolved before paint), so no `auto` branch is needed and matchMedia only covers an absent attribute. - useSandboxUrl: correct the doc to say it fetches on mount AND re-fetches on baseUrl/authToken change (idempotent), not "once on mount". Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent b8d9a67 commit fc162bb

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎clients/web/src/components/elements/AppRenderer/createAppBridgeFactory.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ export interface AppBridgeFactoryDeps {
5353
* every theme flip. The theme is read once per bridge build (the value at open
5454
* time); pushing live theme updates to an already-open app would need an
5555
* AppBridge.setHostContext follow-up.
56+
*
57+
* The attribute is only ever `"light"` or `"dark"` — Mantine resolves
58+
* `defaultColorScheme="auto"` to the system value before paint and never writes
59+
* `"auto"` here, so no `auto` branch is needed. The matchMedia fallback only
60+
* covers the attribute being absent (e.g. a hydration race).
5661
*/
5762
function currentTheme(): "light" | "dark" {
5863
if (typeof document !== "undefined") {

‎core/react/useSandboxUrl.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
* the trusted outer iframe of the double-iframe sandbox; without it MCP Apps
88
* cannot run, so the screen renders an unavailable state instead.
99
*
10-
* Fetches once on mount. `sandboxUrl` is `undefined` until the fetch resolves
11-
* and stays `undefined` if the backend omits it (legacy backend, or a build
12-
* without the sandbox controller) — callers should treat that as "Apps
13-
* unavailable" rather than falling back to a blank iframe.
10+
* Fetches on mount, and re-fetches if `baseUrl` or `authToken` changes (rare —
11+
* effectively a full reload; the GET is idempotent). `sandboxUrl` is `undefined`
12+
* until the fetch resolves and stays `undefined` if the backend omits it (legacy
13+
* backend, or a build without the sandbox controller) — callers should treat
14+
* that as "Apps unavailable" rather than falling back to a blank iframe.
1415
*/
1516

1617
import { useCallback, useEffect, useState } from "react";

0 commit comments

Comments
 (0)