Skip to content

fix(desktop): send host theme to built canvas artifacts - #78693

Merged
trunk-io[bot] merged 2 commits into
masterfrom
fix/canvas-built-dark-mode
Aug 6, 2026
Merged

fix(desktop): send host theme to built canvas artifacts#78693
trunk-io[bot] merged 2 commits into
masterfrom
fix/canvas-built-dark-mode

Conversation

@charlesvien

@charlesvien charlesvien commented Aug 6, 2026

Copy link
Copy Markdown
Member

Problem

Published canvases render in light mode inside a dark app. Dark mode stopped working when canvases moved to cloud-built artifacts (#76649): the artifact path lost the theme bridge that edit mode still has.

Changes

  • BuiltCanvas posts a set-theme frame over the bridge port after connect and on every host theme change, matching FreeformCanvas.
  • The mount-time theme rides a #theme= fragment on the artifact URL, so the new runtime themes the first paint instead of waiting for the port. Fragments do not reach the server, so signed URLs stay valid.
  • The host iframe gets color-scheme, so the UA does not paint the embedded canvas white before the artifact loads.

Note

Existing artifacts embed the old runtime and stay light until their canvas rebuilds with #78694 deployed.

No screenshot: I did not run the desktop app against a real built artifact.

How did you test this code?

  • New BuiltCanvas test: the srcDoc carries the theme fragment, the iframe carries color-scheme, and the bridge port receives a dark frame on connect and a light frame on theme change. Catches the host dropping theme wiring again.
  • Ran the freeform canvas Vitest suite and @posthog/ui typecheck locally.
  • Not checked: the running app with a real built artifact.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code session. Skills invoked: canvas-templates, writing-tests, writing-pr-descriptions. I traced the regression to the cloud artifacts port, which swapped the theme-aware sandbox for the artifact path on published builds. Originally one PR with the builder half; split into #78694 when the desktop backend coupling check failed. The pre-paint fragment and iframe color-scheme address a Greptile review comment about the light flash before the bridge connects.

@charlesvien charlesvien self-assigned this Aug 6, 2026
@trunk-io

trunk-io Bot commented Aug 6, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@charlesvien
charlesvien marked this pull request as ready for review August 6, 2026 06:25
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team August 6, 2026 06:25
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 54d2833.

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/desktop/packages/ui/src/features/canvas/freeform/BuiltCanvas.tsx:170-174
**Cover the initial color scheme**

The initial theme is delivered only after the artifact runtime starts its message port, so a dark-themed artifact can first paint its background, native controls, or scrollbars using the light color scheme. Apply the resolved scheme at the iframe level as FreeformCanvas does to cover the pre-runtime paint.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(canvas): mirror host dark mode into ..." | Re-trigger Greptile

@charlesvien charlesvien changed the title fix(canvas): mirror host dark mode into built canvas artifacts fix(desktop): send host theme to built canvas artifacts Aug 6, 2026
@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Aug 6, 2026
@trunk-io

trunk-io Bot commented Aug 6, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@charlesvien charlesvien added the stamphog Request AI approval (no full review) label Aug 6, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Contained desktop-UI theming fix (iframe/message-bridge only, no schema/API/auth/CI/dependency surface); it adds test coverage and the diff directly addresses Greptile's resolved review comment about the pre-paint color-scheme flash via the new iframe colorScheme style.

  • 👍 on the PR from greptile-apps[bot], hex-security-app[bot].
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 69L, 1F substantive, 137L/2F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (137L, 2F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ ada83d8 · reviewed head 54d2833

@charlesvien

Copy link
Copy Markdown
Member Author

/trunk merge

@trunk-io
trunk-io Bot merged commit c1d4049 into master Aug 6, 2026
235 checks passed
@trunk-io
trunk-io Bot deleted the fix/canvas-built-dark-mode branch August 6, 2026 07:31
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-06 08:09 UTC Run
prod-us ✅ Deployed 2026-08-06 08:26 UTC Run
prod-eu ✅ Deployed 2026-08-06 08:28 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/desktop Feature Tag: Desktop stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant