Skip to content

fix(blocks): resolve the Create preview iframe under the Pages basePath - #41

Merged
yyyyaaa merged 1 commit into
mainfrom
fix/create-preview-basepath
Sep 22, 2026
Merged

yyyyaaa merged 1 commit into
mainfrom
fix/create-preview-basepath

Conversation

@yyyyaaa

@yyyyaaa yyyyaaa commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

On the deployed site, /blocks/blocks/create/ embedded /blocks/create/preview/ — the basePath was missing — so GitHub Pages served the 404 page and the docs shell rendered inside itself (the "inception" screenshot).

  • Root cause: BLOCKS_PAGES is a plain env var, so it is only defined for server code. withBase() runs in the browser for the preview iframe (preview-frame.tsx), where BASE_PATH evaluated to ''.
  • Fix: next.config.ts inlines a NEXT_PUBLIC_BLOCKS_PAGES mirror into the client bundle and site.ts checks both variables.

Verified against a real pnpm build:pages export served under /blocks/: clicking Create yields iframe src="/blocks/blocks/create/preview/?d=…", the preview renders the platform wall, no nested frame, no 4xx responses.

Generated with Devin

…w iframe resolves

BLOCKS_PAGES is only visible to server code, so in the browser withBase()
dropped the /blocks basePath and the Create page embedded
/blocks/create/preview/, which 404s on GitHub Pages and rendered the docs
shell inside itself. next.config now inlines a NEXT_PUBLIC_BLOCKS_PAGES mirror
and site.ts checks both, so the iframe points at /blocks/blocks/create/preview/.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@tenki-reviewer

tenki-reviewer Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This small PR (2 files, ~30 diff lines) touches the blocks documentation app's Next.js config and its shared site library. The scan passed the changed files through correctness and holistic review with no findings above threshold, so no inline comments were produced and no defects were flagged for the author.

Files Change
apps/blocks/next.config.ts Adjusts Next.js build/runtime configuration for the blocks docs app.
apps/blocks/src/lib/site.ts Updates shared site helper logic used by the docs app.

Reviewed commit: adf0ea5

@yyyyaaa
yyyyaaa merged commit f37c72d into main Sep 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant