summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Martin Trapp <94928215+martrapp@users.noreply.github.com> 2023-11-06 18:48:34 +0100
committerGravatar GitHub <noreply@github.com> 2023-11-06 18:48:34 +0100
commit35739d01e9cc4fa31a8b85201feecf29c747eca9 (patch)
treef4b36c9623f2b0a17a1898f06a2d5ee2e65b9e89
parent4983acea8c7a1b2747ceea6a5d0b31003567d05a (diff)
downloadastro-35739d01e9cc4fa31a8b85201feecf29c747eca9.tar.gz
astro-35739d01e9cc4fa31a8b85201feecf29c747eca9.tar.zst
astro-35739d01e9cc4fa31a8b85201feecf29c747eca9.zip
Fix DEV mode on Safari when view transitioning to client:only components (#9000)
* Fix DEV mode on Safari when view transitioning to client:only components * Update .changeset/eighty-ladybugs-shake.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
-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