fix: to support @react-email/render exports across versions in templates#863
Open
Shubhdeep12 wants to merge 4 commits intoresend:canaryfrom
Open
fix: to support @react-email/render exports across versions in templates#863Shubhdeep12 wants to merge 4 commits intoresend:canaryfrom
Shubhdeep12 wants to merge 4 commits intoresend:canaryfrom
Conversation
commit: |
gabrielmfern
requested changes
Mar 5, 2026
src/templates/templates.ts
Outdated
| throw new Error( | ||
| 'Failed to render React component. Make sure to install `@react-email/render`', | ||
| ); | ||
| const mod = await import('@react-email/render'); |
Contributor
Author
There was a problem hiding this comment.
yeah, i thought earlier, since it's a peer dep, we wanted to give support for renderAsync.
thanks for the review, made the changes.
Member
There was a problem hiding this comment.
that's valid, but it should be done in that render function and reused
Contributor
Author
There was a problem hiding this comment.
i removed it in the last commit, lemme add the support of renderAsync back
and to render.ts that the right place
…ender and update tests accordingly
gabrielmfern
reviewed
Mar 6, 2026
src/templates/templates.ts
Outdated
| payload.html = await this.renderAsync( | ||
| payload.react as React.ReactElement, | ||
| ); | ||
| payload.html = await render(payload.react as React.ReactElement); |
Member
There was a problem hiding this comment.
I don't think this cast is required, is it?
Contributor
Author
There was a problem hiding this comment.
yeah we can remove it, especially as we are narrowing the scope here with ReactElement.
lemme remove it and from other places as well.
… and asynchronous rendering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@react-email/renderdropped renderAsync in v2.0.0.Summary by cubic
Adds a shared render helper that works with @react-email/render v1 and v2 by preferring render and falling back to renderAsync. Uses it in Templates and Emails with clearer errors.
Written for commit b05636e. Summary will update on new commits.