Repository navigation
Conversation
…idget The managed marker block in a JSX root shell or Astro layout now has two branches. A production build still sets the production marker. Any other build sets window.__PATCHSTACK_ENV__="sandbox", the stamp the widget already reads as a preview. A builder preview served from a host the widget does not list now shows the owner's panel instead of nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
/review |
|
🎯 Elite quality (97%) — Converts the production-only marker into a ternary that stamps non-production builds as a sandbox, with matching tests. 📦 Small |
Contributor
Author
|
/review |
terdelyi
approved these changes
Oct 29, 2026
Contributor
Author
|
Closing in favour of a narrower fix that leaves Connect's output unchanged: v0's sandbox preview host ( |
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.
No ticket.
What changed
The Patchstack block that setup and
scanwrite into a JSX root layout (or an Astro layout) now covers every kind of build, not just production:window.__PATCHSTACK_PROD__/window.__PATCHSTACK_BUILD__).window.__PATCHSTACK_ENV__="sandbox". The widget already reads that stamp as "this is a preview".So the widget now shows its owner panel in a builder's preview even when that preview runs on a host the widget does not know.
Why
The widget still did not show in v0's in-chat preview, even after
vusercontent.netwent on the preview lists (widget #190, SaaS #2355). v0 now runs chat previews somewhere else, and that host could change again. A list of hosts has to chase every builder.The page could already say it is a preview: the widget checks for
window.__PATCHSTACK_ENV__ === "sandbox", andmark-buildwrites that stamp into a sandbox build's HTML. But a dev server never runsmark-build, and the block in the layout said nothing outside production ({gate && (…)}). On an unknown host, with no marker and no stamp, the widget had no reason to show anything.Fix
buildSourceMarkerSnippetinsrc/mark-build.tsnow returns{gate ? (<production marker>) : (<sandbox stamp>)}. The gate is the same framework expression as before (process.env.NODE_ENV === 'production',import.meta.env.PROD,!import.meta.dev), so a production build gets the same marker it always did.scanremoves it and writes it again every time. Existing apps get the new shape on their next install or build (thepostinstallandprebuildhooks both runscan) once they update@patchstack/connect.AGENT-INSTALL.md: the paragraph about the production marker said the block was "inert in dev and preview builds". It now says what the block does in those builds.What this does not change
The block only differs in builds that are not production builds. Everything that works today keeps the answer it has now:
id-preview--…lovable.appandlovableproject.com, Hostinger'sapp-preview.comandai-builder.hostinger.com,localhost) are recognised by host. The widget checks that before it looks at the stamp.hostingersite.com,replit.app,bolt.host), the production marker, and the server's own "live" answer for the site's registered address are also checked before the stamp.One case does change. A live site that runs a dev server (not a production build), on a custom domain that isn't the site's registered address. Today the widget hides there. With this, it shows its launcher, closed: a stamp on its own never opens the owner's panel. That is the outcome the widget's design record already accepts for a wrongly stamped live site, and
data-build-mode="false"on the widget tag turns the owner's panel off on that page.Verified
app/layout.tsx(shared by the owner; it already had the old block):tests/mark-build.test.ts:tests/guide.test.ts: the printed snippet test now expects the new shape.npm run typecheck,npm run buildandcapabilities:checkare green. Fullnpm test: 4652 passed, 7 skipped.Out of scope, worth a follow-up
Docs:
AGENT-INSTALL.mdupdated (the production marker paragraph). Agents read the shipped docs, so the hostile field test is owed after the release that carries this, plusstandard/lovablefor doc accuracy.🤖 Generated with Claude Code