Skip to content

fix: Prevent Partytown cross-origin errors in iframe environments - #3155

Merged
hellofanny merged 4 commits into
devfrom
chore/remove-partytown
Jan 8, 2026
Merged

hellofanny merged 4 commits into
devfrom
chore/remove-partytown

Conversation

@mmartinsoliv

@mmartinsoliv mmartinsoliv commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

What's the problem this PR addresses?

When FastStore is loaded inside an iframe (such as VTEX
Preview), Partytown throws a SecurityError: Failed to read a
named property 'dispatchEvent' from 'Window' due to
cross-origin restrictions. This prevents the preview from
working correctly.

Changes Made:

  • Modified ThirdPartyScripts.tsx to dynamically import
    Partytown only on client-side

@mmartinsoliv
mmartinsoliv requested a review from a team as a code owner December 12, 2025 19:33
@mmartinsoliv
mmartinsoliv requested review from gabpaladino and lucasfp13 and removed request for a team December 12, 2025 19:33
@codesandbox-ci

codesandbox-ci Bot commented Dec 12, 2025 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@mmartinsoliv
mmartinsoliv force-pushed the chore/remove-partytown branch 2 times, most recently from e19b443 to fe671bb Compare December 15, 2025 19:45
@mmartinsoliv mmartinsoliv changed the title Chore/remove partytown fix: Prevent Partytown cross-origin errors in iframe environments Dec 16, 2025
@mmartinsoliv
mmartinsoliv force-pushed the chore/remove-partytown branch from a4aba32 to 8b7d80a Compare December 16, 2025 15:33
@lemagnetic

Copy link
Copy Markdown
Contributor

Hey @mmartinsoliv! Quick check: I can only see changes in ThirdPartyScripts.tsx in the diff. Are the other updates mentioned in “Changes Made” already covered elsewhere or were they reverted?

@mmartinsoliv

Copy link
Copy Markdown
Contributor Author

Hey @mmartinsoliv! Quick check: I can only see changes in ThirdPartyScripts.tsx in the diff. Are the other updates mentioned in “Changes Made” already covered elsewhere or were they reverted?

Hi @lemagnetic! I updated the readme file. The only adjustment is adding a conditional statement.

@hellofanny
hellofanny merged commit 997252e into dev Jan 8, 2026
@hellofanny
hellofanny deleted the chore/remove-partytown branch January 8, 2026 21:34
thiagopereira-vtex pushed a commit that referenced this pull request Mar 10, 2026
)

## What's the problem this PR addresses?

  When FastStore is loaded inside an iframe (such as VTEX
  Preview), Partytown throws a SecurityError: Failed to read a 
  named property 'dispatchEvent' from 'Window' due to
  cross-origin restrictions. This prevents the preview from
  working correctly.

  ## Changes Made:

  - Modified ThirdPartyScripts.tsx to dynamically import
  Partytown only on client-side
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants