Skip to content

Conversation

@gabrielmfern
Copy link
Member

@gabrielmfern gabrielmfern commented Nov 13, 2025

You can test this in the preview deploy of the demo


Summary by cubic

Fixes download filenames in the preview server to use the actual email file name and correct extension. Also standardizes language keys for tabs and downloads.

  • Bug Fixes
    • Send basename and extname from renderEmailByPath to the preview UI.
    • Generate download names as basename.extension, falling back to language when needed.
    • Normalize language keys: tsx for React, html for HTML; set default active language to tsx.
    • Provide correct extensions: use email extname for React, 'html' for HTML, and 'md' for Markdown.

Written for commit 78bbe77. Summary will update automatically on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: 78bbe77

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

@vercel
Copy link

vercel bot commented Nov 13, 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 Nov 13, 2025 5:48pm
react-email-demo Ready Ready Preview Comment Nov 13, 2025 5:48pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 13, 2025

Open in StackBlitz

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

commit: 78bbe77

@gabrielmfern gabrielmfern merged commit 1d35e37 into canary Nov 13, 2025
16 checks passed
@gabrielmfern gabrielmfern deleted the fix/language-types branch November 13, 2025 17:49
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.

1 issue found across 5 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/preview-server/src/app/preview/[...slug]/preview.tsx">

<violation number="1" location="packages/preview-server/src/app/preview/[...slug]/preview.tsx:39">
Refactoring `lang` identifiers from `jsx`/`markup` to `tsx`/`html` without handling old values in URL parameters causes a crash. Visiting a previously valid URL with `?lang=jsx` will now break the source view.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

const isDarkModeEnabled = searchParams.get('dark') !== null;
const activeView = searchParams.get('view') ?? 'preview';
const activeLang = searchParams.get('lang') ?? 'jsx';
const activeLang = searchParams.get('lang') ?? 'tsx';
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 13, 2025

Choose a reason for hiding this comment

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

Refactoring lang identifiers from jsx/markup to tsx/html without handling old values in URL parameters causes a crash. Visiting a previously valid URL with ?lang=jsx will now break the source view.

Prompt for AI agents
Address the following comment on packages/preview-server/src/app/preview/[...slug]/preview.tsx at line 39:

<comment>Refactoring `lang` identifiers from `jsx`/`markup` to `tsx`/`html` without handling old values in URL parameters causes a crash. Visiting a previously valid URL with `?lang=jsx` will now break the source view.</comment>

<file context>
@@ -36,7 +36,7 @@ const Preview = ({ emailTitle, className, ...props }: PreviewProps) =&gt; {
   const isDarkModeEnabled = searchParams.get(&#39;dark&#39;) !== null;
   const activeView = searchParams.get(&#39;view&#39;) ?? &#39;preview&#39;;
-  const activeLang = searchParams.get(&#39;lang&#39;) ?? &#39;jsx&#39;;
+  const activeLang = searchParams.get(&#39;lang&#39;) ?? &#39;tsx&#39;;
 
   const handleDarkModeChange = (enabled: boolean) =&gt; {
</file context>
Fix with Cubic

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.

3 participants