Skip to content

fix(preview-server): skip data-source-* props on Fragment elements#3059

Open
mvanhorn wants to merge 1 commit intoresend:canaryfrom
mvanhorn:osc/2943-fix-jsxdev-fragment-data-source-props
Open

fix(preview-server): skip data-source-* props on Fragment elements#3059
mvanhorn wants to merge 1 commit intoresend:canaryfrom
mvanhorn:osc/2943-fix-jsxdev-fragment-data-source-props

Conversation

@mvanhorn
Copy link

@mvanhorn mvanhorn commented Mar 13, 2026

Summary

The custom jsxDEV wrapper in @react-email/preview-server unconditionally adds data-source-file and data-source-line props to all JSX elements, including React.Fragment. Since Fragments only accept key and children props, this triggers a React 18 warning:

Warning: Invalid prop `data-source-file` supplied to `React.Fragment`.
React.Fragment can only have `key` and `children` props.

This PR adds a type !== Fragment guard so data-source props are only added to non-Fragment elements.

Fixes #2943

Changes

  • packages/preview-server/jsx-runtime/jsx-dev-runtime.js: Added type !== Fragment condition to the source reference guard

This contribution was developed with AI assistance (Claude Code).


Summary by cubic

Skip adding data-source-file and data-source-line props to React.Fragment in the @react-email/preview-server jsxDEV wrapper. This removes React 18 invalid prop warnings by only adding source props to non-Fragment elements.

Written for commit f29a11c. Summary will update on new commits.

Fragments only accept `key` and `children` props. Adding `data-source-file`
and `data-source-line` to Fragments triggers React 18 warnings.

Fixes resend#2943

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 13, 2026

@mvanhorn is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

⚠️ No Changeset found

Latest commit: f29a11c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 13, 2026

Open in StackBlitz

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

commit: ff3a5e3

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 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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.

jsxDEV wrapper adds data-source-* props to Fragments, causing React 18 warnings

1 participant