a template previews against something real

The builder loaded the template's own slug — `/collection` — which is not an address, so the frame
showed a 404 while the same arrangement rendered perfectly at /collections/70s in a tab. The page was
fine; the preview was asking for the wrong URL.

It previews an instance now: whichever the server names in `preview_slug`, the first of whatever the
template draws. Which row it is does not matter and deliberately is not a choice — a template IS the
arrangement, and the point of the preview is to see the arrangement with something real in it.

Null when there is nothing to draw yet, which shows as an empty preview rather than a broken one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-04 15:03:32 +01:00
co-authored by Claude Opus 5
parent 671f049fb3
commit cb6026059a
2 changed files with 16 additions and 1 deletions
+8 -1
View File
@@ -1017,7 +1017,14 @@ export const PageBuilderPanel = () => {
has no leading slash — Home's is the empty string, which the proxy resolves to the root. */}
{/* `reloadToken` moves on every write, which refetches the document AND re-runs `onDocument` —
so the decoration is redrawn against the sections that now exist. */}
<SitePreview port={devPort} path={page.slug} onDocument={onDocument} reloadToken={rendered} />
{/* A TEMPLATE is previewed against a real instance — its own slug is not an address. See
preview_slug, which the server fills from the first thing the template draws. */}
<SitePreview
port={devPort}
path={page.is_template ? (page.preview_slug ?? page.slug) : page.slug}
onDocument={onDocument}
reloadToken={rendered}
/>
<AddSectionDialog
open={adding}