diff --git a/.changeset/eighty-ladybugs-shake.md b/.changeset/eighty-ladybugs-shake.md new file mode 100644 index 000000000000..e34d66c971d4 --- /dev/null +++ b/.changeset/eighty-ladybugs-shake.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an error in dev mode on Safari where view transitions prevented navigating to pages with `client:only` components diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index af8a09d97643..da5496f81ff9 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -529,9 +529,8 @@ async function prepareForClientOnlyComponents(newDocument: Document, toLocation: if (newDocument.body.querySelector(`astro-island[client='only']`)) { // Load the next page with an empty module loader cache const nextPage = document.createElement('iframe'); - // do not fetch the file from the server, but use the current newDocument - nextPage.srcdoc = - (newDocument.doctype ? '' : '') + newDocument.documentElement.outerHTML; + // with srcdoc resolving imports does not work on webkit browsers + nextPage.src = toLocation.href; nextPage.style.display = 'none'; document.body.append(nextPage); // silence the iframe's console