You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
in 'use server' file you can only export async functions. under the hood, server actions are POST requests. you can export a request initializations but not any other type of information
in 'use server' file you can only export async functions. under the hood, server actions are POST requests. you can export a request initializations but not any other type of information
I know that, but we should display the warning in both server and client code. Not just server. Otherwise beginners could fail.
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 inOk, 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 casehttps://codesandbox.io/p/devbox/old-voice-mt3592?file=%2Fapp%2Fpage.tsx
The text was updated successfully, but these errors were encountered: