raw-apps: prevent + surface the silent blank-screen (unmounted #root)#9975
Draft
Guilhem-lm wants to merge 3 commits into
Draft
raw-apps: prevent + surface the silent blank-screen (unmounted #root)#9975Guilhem-lm wants to merge 3 commits into
Guilhem-lm wants to merge 3 commits into
Conversation
Deploying windmill with
|
| Latest commit: |
6512baf
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f0f827c5.windmill.pages.dev |
| Branch Preview URL: | https://glm-fix-react-blank-app.windmill.pages.dev |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirror the runtime-error overlay for the silent blank-screen case: when the preview reports `emptyRender` (build ran cleanly but never mounted #root), show an info Alert pointing at the missing createRoot(...).render(...) call. The handler is dormant-safe until the builder tarball that emits `emptyRender` is pinned, so it can land ahead of the artifact bump. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ad80138 to
3edd3e6
Compare
Handle the preview's `renderAppeared` message (posted when a slow app mounts #root after the empty-render grace window) by clearing the "Nothing rendered" hint, so a legitimate late render doesn't leave a false-positive overlay. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AI-generated (or hand-written) React raw apps could render a blank screen with no error when
index.tsxwas written as a bareexport default function App() {...}that never mounts anything. The preview harness bundles and executesindex.tsxagainst an empty<div id="root">but does not auto-render a default export — the entrypoint must itself callcreateRoot(document.getElementById('root')!).render(<App />). When it doesn't, the JSX lives inside an uncalled function, so nothing throws and the runtime-error overlay stays silent.This PR tackles the failure mode from two sides:
Changes
Prompt (prevention)
system_prompts/base/raw-app.md— rewrote the Entrypoint section:index.tsxis the bundling and mount entrypoint, MUST mountAppinto#root(React/Svelte/Vue snippets), and never be replaced with a bare component. Added a blank-screen debugging note.frontend/src/lib/components/copilot/chat/app/core.ts— same mount-entrypoint guidance in the in-chat app system prompt's Frontend section.system_prompts/generate.py:prompts.ts,skills/raw-app/SKILL.md,cli/src/guidance/skills.gen.ts.Overlay (detection)
frontend/src/lib/components/raw_apps/RawAppEditor.svelte— handle a newemptyRendermessage from the preview iframe and render an infoAlert("Nothing rendered") pointing at the missingcreateRoot(...).render(...)call. Mirrors the existing runtime-error overlay; cleared on next build.renderAppeared— the preview retracts the hint if a slow app (async fetch, Suspense) mounts#rootafter the grace window, so a legitimate late render can't leave a false-positive overlay.#rootafter each build and postsemptyRenderwhen nothing mounted (suppressed if a runtime error already explained the blank screen), then watches for a late mount to postrenderAppeared.Screenshots
A bare-component
index.tsx(export default App, nocreateRoot) builds successfully (see logs) yet mounts nothing — the "Nothing rendered" overlay names the fix.Sequencing
The overlay only fires once the builder tarball emits
emptyRender:frontend/scripts/ui_builder_artifact.json(new version + sha256) — follow-up commit on this PR.Test plan
index.tsxincludescreateRoot(document.getElementById('root')!).render(<App />)rather than a bare component.#root; runtime error suppresses it (browser-verified, see screenshot).#rootfilled at 1000ms) → overlay appears @612ms, retracts @1018ms viarenderAppeared; permanently-empty build keeps the overlay; immediate render never shows it.🤖 Generated with Claude Code