Skip to content
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

Unable to render in a next.js server action #40

Closed
yannxaver opened this issue Oct 12, 2023 · 7 comments
Closed

Unable to render in a next.js server action #40

yannxaver opened this issue Oct 12, 2023 · 7 comments

Comments

@yannxaver
Copy link
Contributor

yannxaver commented Oct 12, 2023

Expected Behavior

Should be able to render in a server action.

Actual Behavior

You're importing a component that imports react-dom/server. To fix it, render or return the content directly as a Server Component instead for perf and security.
Learn more: https://nextjs.org/docs/getting-started/react-essentials

The error was caused by importing '@jsx-email/render/dist/es/index.js' in './app/action.ts'.

Additional Information

This is related to
resend/react-email#871
vercel/next.js#43810 (probably includes the fix)

It has been fixed in react-email already because I was able to render in a server action using their package before.

@shellscape
Copy link
Owner

#36 will resolve this.

@shellscape
Copy link
Owner

Please try the latest version of render. The all package is on a delay.

@yannxaver
Copy link
Contributor Author

Looks good. (https://stackblitz.com/edit/stackblitz-starters-f4gt7r?file=package.json)

So the solution for now would be to install all components individually and to not use the all package?
When do you roughly expect it to be updated?

tbh, it was unexpected that the all package exports render as well. In the docs it sounds like it just exports the components.

@shellscape
Copy link
Owner

thought about changing that too, but went with it as it is to make it easy for people to switch from react-render

@shellscape
Copy link
Owner

all v2.1.0 published

Please give this a test and let us know how it works out

@yannxaver
Copy link
Contributor Author

No more error message (https://stackblitz.com/edit/stackblitz-starters-83gr6n?file=app%2Faction.ts)

The rendering output also looks good.

Do you plan to publish releases here with change logs? I would subscribe to them.

@shellscape
Copy link
Owner

Do you plan to publish releases here with change logs? I would subscribe to them.

possibly in the future, but for now we're just tagging and updating the changelog.

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

No branches or pull requests

2 participants