Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(html): prevent react 19 script tag duplication #5334

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

epetrow
Copy link
Contributor

@epetrow epetrow commented Feb 7, 2025

With React 19, <script> tags inside components are now rendered instead of being ignored.

It seems like it will do this only if the tag is a direct child of <body>

What I've tried so far is:

  • remove the <script> tag from packages/html/shared/index.html and add it later in build-tests.js

This does not seem like a valid solution since it seems it does not matter whether the <script> is in packages/html/shared/index.html or packages/html/dist/. It will be rendered if it is a direct child of body.

  • wrap the <script> tag inside a div

While it may not seem like the best solution it does work and does not produce an additional <div> wrapper in our tests.

  • trim the extra <script> tag before creating screenshots

This seems like a more valid solution

@epetrow epetrow requested a review from a team as a code owner February 7, 2025 13:56
@epetrow epetrow self-assigned this Feb 7, 2025
@epetrow epetrow added this to the 2025 Q1 (Feb) milestone Feb 7, 2025
@epetrow epetrow force-pushed the duplicate-script-tag branch from cca961d to 145c002 Compare February 7, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant