Skip to content

Commit

Permalink
Merge pull request #65 from withastro/main
Browse files Browse the repository at this point in the history
Fix DEV mode on Safari when view transitioning to client:only compone…
  • Loading branch information
akshit20421 authored Nov 7, 2023
2 parents 46fc269 + 35739d0 commit 227035f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-ladybugs-shake.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions packages/astro/src/transitions/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 227035f

Please sign in to comment.