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

[React 19] Issue with server action "use server" and exported error (Maybe NextJS) #28994

Open
ScreamZ opened this issue May 5, 2024 · 0 comments
Labels

Comments

@ScreamZ
Copy link

ScreamZ commented May 5, 2024

Hi,

Not sure if this is related to NextJS or React.

exporting an enum from a server action in a file with "use server" results in

Error: A "use server" file can only export async functions, found object.

Ok, perfect.

Now just add a use client to your page. No more error.

In my example I try to print Object.values(ContactFormTopics) which gives me an empty array. This is error-prone, maybe we need a way to detect such use case

https://codesandbox.io/p/devbox/old-voice-mt3592?file=%2Fapp%2Fpage.tsx

@ScreamZ ScreamZ changed the title [React 19] [React 19] Issue with server action "use server" and exported error (Maybe NextJS) May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant