Skip to content

Conversation

gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Sep 9, 2025

For background, we use a custom JSX runtime that, if there is a certain boolean as true in the globalThis, it then adds in data-source-* properties pointing to the filename and line of the HTML element. We render multiple times, once with this just to be able to interpolate where errors happen, and another time without.

The issues were being caused by the fact that we were rendering in “parallel” with Promise.all, which made that global value be enabled when it shouldn't. To fix this I've just changed it to not use Promise.all, which didn't have as much of a performance impact as I expected.


Summary by cubic

Fixes data-source-* attributes incorrectly appearing in the HTML code view by running email renders sequentially. This avoids the global JSX flag leaking across parallel renders.

  • Bug Fixes
    • Replaced Promise.all with sequential awaits to isolate global state during rendering.
    • data-source-* attributes now only appear in the reference render; pretty/regular HTML and plaintext outputs are clean.
    • No noticeable performance impact.

@gabrielmfern gabrielmfern requested a review from a team as a code owner September 9, 2025 14:21
@gabrielmfern gabrielmfern requested review from CarolinaMoraes and removed request for a team September 9, 2025 14:21
Copy link

changeset-bot bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 79bb589

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@react-email/preview-server Patch
react-email Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-email Ready Ready Preview Comment Sep 9, 2025 2:29pm
react-email-demo Ready Ready Preview Comment Sep 9, 2025 2:29pm

@gabrielmfern gabrielmfern requested review from a team and pedro-stramantinoli and removed request for a team and CarolinaMoraes September 9, 2025 14:23
Copy link

pkg-pr-new bot commented Sep 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/preview-server@2444

commit: 79bb589

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@gabrielmfern gabrielmfern merged commit 0700b91 into main Sep 9, 2025
13 checks passed
@gabrielmfern gabrielmfern deleted the fix/data-source-in-html-code-view branch September 9, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants