Skip to content

Commit

Permalink
Fix DEV mode on Safari when view transitioning to client:only components
Browse files Browse the repository at this point in the history
  • Loading branch information
martrapp committed Nov 5, 2023
1 parent 910eb00 commit ad5a93b
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
---

Fix DEV mode on Safari when view transitioning to `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 ad5a93b

Please sign in to comment.