Skip to content

Commit

Permalink
Prevent Partytown integration from inserting a 'null' string into the…
Browse files Browse the repository at this point in the history
… body (#11829)
  • Loading branch information
oosawy authored Aug 26, 2024
1 parent 1ffaae0 commit f1df1b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/eight-rice-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/partytown': patch
---

Prevent Partytown integration from inserting a 'null' string into the body
2 changes: 1 addition & 1 deletion packages/integrations/partytown/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function createPlugin(options?: PartytownOptions): AstroIntegrati
hooks: {
'astro:config:setup': ({ config: _config, command, injectScript }) => {
const lib = `${appendForwardSlash(_config.base)}~partytown/`;
const recreateIFrameScript = `;(e=>{e.addEventListener("astro:before-swap",e=>{let r=document.body.querySelector("iframe[src*='${lib}']");e.newDocument.body.append(r)})})(document);`;
const recreateIFrameScript = `;(e=>{e.addEventListener("astro:before-swap",e=>{let r=document.body.querySelector("iframe[src*='${lib}']");if(r)e.newDocument.body.append(r)})})(document);`;
const partytownConfig = {
lib,
...options?.config,
Expand Down

0 comments on commit f1df1b3

Please sign in to comment.