Skip to content

feat(react-email): Non-encoded email slugs #1203

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 3 commits into from
Feb 15, 2024

Conversation

gabrielmfern
Copy link
Collaborator

@gabrielmfern gabrielmfern commented Jan 19, 2024

What does this do?

The preview app's pages for email previews were always encoding the slugs for emails
that had subdirectories making the user experience a bit worse and causing URLs to not
looks so pretty without any gain. The way I fixed this was just by using a catch-all router
for the [slug] page as [...slug] and then giving the appropriate treatment to the
path segments.

This also has the added benefit of fixing the build process failing when the emails have
subdirectories. This fixes it because when generating the static parameters for the [slug]
we forgot to implement the encoding of the characters for the URL.

How can I test to make its working?

  1. Run npx tsx ../../packages/react-email/src/cli/index.ts dev inside of ./apps/demo
  2. Create a new folder inside of ./apps/demo
  3. Move some email inside of it
  4. Open http://localhost:3000
  5. Navigate to any email on the directory you created
  6. Verify that the URL does not contain encoded characters

Copy link

vercel bot commented Jan 19, 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 14, 2024 6:45pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
react-email-demo ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2024 6:45pm

@gabrielmfern gabrielmfern changed the title feat(react-email): Improved preview URLS feat(react-email): Non-encoded email slugs Jan 22, 2024
vcapretz
vcapretz previously approved these changes Feb 13, 2024
@gabrielmfern gabrielmfern merged commit ac04dfe into canary Feb 15, 2024
@gabrielmfern gabrielmfern deleted the feat/improved-preview-urls branch February 15, 2024 17:13
@gabrielmfern
Copy link
Collaborator Author

Thank you @vcapretz

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.

2 participants