Skip to content

fix(preview): relative iframe src for subpath deployment (bd-0pm7a)#226

Merged
shikokuchuo merged 2 commits into
mainfrom
bugfix/bd-0pm7a-iframe-src-relative
May 21, 2026
Merged

fix(preview): relative iframe src for subpath deployment (bd-0pm7a)#226
shikokuchuo merged 2 commits into
mainfrom
bugfix/bd-0pm7a-iframe-src-relative

Conversation

@shikokuchuo
Copy link
Copy Markdown
Member

@shikokuchuo shikokuchuo commented May 21, 2026

Closes bd-0pm7a.

Q2DebugIframe and Q2PreviewIframe hard-coded src="/q2-*.html", which is root-absolute and bypasses Vite's base: './'.

Locally and under Playwright the SPA is served at the host root so the two coincide; under a subpath deployment the iframe requested https://host/q2-*.html and got the platform's 404 / SPA shell, leaving the preview blank.

Dropping the leading slash resolves the iframe against the parent doc's pathname, matching how the rest of the build references its assets. Hash-only routing (hub-client/src/utils/routing.ts) keeps the parent pathname stable across client navigation, so the relative form is correct at every route.

Verified locally by serving hub-client/dist/ under a /app/ subpath.

Q2DebugIframe and Q2PreviewIframe hard-coded `src="/q2-*.html"`, which
is root-absolute and bypasses Vite's `base: './'`. Locally and in
Playwright the SPA is served at the host root so the two coincide;
under a subpath deployment the iframe requested `https://host/q2-*.html`
and got the platform's 404 / SPA shell, blanking the preview. Dropping
the leading slash resolves the iframe against the parent doc's
pathname, matching how the rest of the build references its assets.
Hash-only routing keeps the parent's pathname stable across client
navigation, so the relative form is correct at every route.
@shikokuchuo shikokuchuo merged commit c4e01ed into main May 21, 2026
4 of 5 checks passed
@shikokuchuo shikokuchuo deleted the bugfix/bd-0pm7a-iframe-src-relative branch May 21, 2026 12:31
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