summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/eighty-ladybugs-shake.md5
-rw-r--r--packages/astro/src/transitions/router.ts5
2 files changed, 7 insertions, 3 deletions
diff --git a/.changeset/eighty-ladybugs-shake.md b/.changeset/eighty-ladybugs-shake.md
new file mode 100644
index 000000000..e34d66c97
--- /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 af8a09d97..da5496f81 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 ? '<!DOCTYPE html>' : '') + 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