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

Nit: server actions can't be passed events #7175

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

rickhanlonii
Copy link
Member

@rickhanlonii rickhanlonii commented Sep 19, 2024

The current example would error with:

Error: Only plain objects, and a few built-ins, can be passed to Server Actions. Classes or null prototypes are not supported

The issue is that the onClick passes an event handler to the server function.

Thanks @bayes for reporting.

Copy link

vercel bot commented Sep 19, 2024

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

Name Status Preview Comments Updated (UTC)
19-react-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 19, 2024 6:36pm
react-dev ✅ Ready (Inspect) Visit Preview Sep 19, 2024 6:36pm

Copy link

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@rickhanlonii rickhanlonii merged commit 39abc60 into reactjs:main Sep 19, 2024
6 checks passed
@rickhanlonii
Copy link
Member Author

Also filed facebook/react#31005 to update the text to say "server function" instead of "server action"

@rickhanlonii rickhanlonii deleted the rh/server-action-click branch September 19, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants