Skip to content

feat(react-email): No forced file extensions on slugs #1215

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

Merged
merged 10 commits into from
Feb 16, 2024

Conversation

gabrielmfern
Copy link
Collaborator

@gabrielmfern gabrielmfern commented Jan 20, 2024

What was the issue?

Users were being forced into always having a .tsx at the end of the path
for the preview app, this fixes that, meaning that if the user navigates around
between emails there won't be any .tsx, but if the user opens the URL
with an existing email and the right file extension, it will render correctly as well.

The latter remark from above is important because it means that we don't really
have to update the docs again to match these paths but the paths are still
going to look better for user experience.

How can I test to make sure it's fixed?

  1. Run npx tsx ../../packages/react-email/src/cli/index.ts dev inside of ./apps/demo
  2. Open http://localhost:3000/preview/airbnb-review.tsx and verify that it works
  3. Open http://localhost:3000/preview/aribnb-review and verify it also works
  4. Navigate between emails and verify that they don't have any .tsx file extension on the URL

Copy link

vercel bot commented Jan 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-email ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 5:19pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
react-email-demo ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 5:19pm

@gabrielmfern gabrielmfern changed the title feat(react-email): No file extensions on slugs feat(react-email): No forced file extensions on slugs Jan 20, 2024
@bukinoshita
Copy link
Member

Should we actually support extensions in the URL? How hard would be to not support it?

@bukinoshita
Copy link
Member

When having .tsx in the url for example, the sidebar item is not active

@gabrielmfern
Copy link
Collaborator Author

gabrielmfern commented Jan 25, 2024

Should we actually support extensions in the URL? How hard would be to not support it?

@bukinoshita I don't think it would be hard but we'd need to change the links on the docs again through another PR maybe. Wdyt about that?

vcapretz
vcapretz previously approved these changes Feb 13, 2024
vcapretz
vcapretz previously approved these changes Feb 15, 2024
@gabrielmfern
Copy link
Collaborator Author

Thank you so much @vcapretz!

@gabrielmfern gabrielmfern merged commit 008fb9a into canary Feb 16, 2024
@gabrielmfern gabrielmfern deleted the feat/no-file-extensions-on-preiew-server branch February 16, 2024 12:58
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