-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[19] s/"Server Action"/"Server Function" #7180
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
[19] s/"Server Action"/"Server Function" #7180
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…are server components server functions
src/content/blog/2023/03/22/react-labs-what-we-have-been-working-on-march-2023.md
Outdated
Show resolved
Hide resolved
Just passing by to report some details that confused me a bit On the v19 docs site there are still examples using Also wondering if there's a canonical place in docs that explains what are actions and server actions (as far as I understand an action is not always necessarily a server action? 🤔 ) It's explained in the v19 RC blog post: But I'm not sure it's explained in the docs yet, or I couldn't find it. Maybe having a docs page about the concept of action could be useful? Overall I'm still a bit confused by what a Server Action is. The way I see it, an async transition might call multiple server functions. startTransition(async function myTransition() {
await serverFn1();
await serverFn2();
}); Here do we consider that Or do we consider I'm wondering if the concept of Server Action makes sense. Maybe there are just Server Functions, Actions, and then it's possible to call Server Functions from Actions and that's it? |
const submitAction = async () => { | ||
startTransition(async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also wondered here why submitAction
is async considering startTransition
returns nothing
Is wrapping in transition necessary in this case when using <form action>
? Isn't the function already an action?
* Convert "Canary" callouts to "React 19 beta" (#6811) * Convert "Canary" callouts to "React 19 beta" * Starting in * Bump version string * Bump deploy * Bump deploy * Bump deploy * [19] Remove <NextMajor> callouts (#6844) * Remove <NextMajor> callouts * rm if(node) * Delete removed APIs from 19 docs (#6845) * Add information about ref handling in strict mode (#6777) * Add information about DOM ref handling in strict mode * switch order of ref object / ref callback in strictmode doc * use 'refs to components' terminology instead of 'DOM refs' * update references to canary/r19 * Expand usage example and remove badges --------- Co-authored-by: Rick Hanlon <[email protected]> * [19] s/"Server Action"/"Server Function" (#7180) * [19] s/Server Action/Server Function * Revert /blog and change redirect * Add note * Tweak note * [v19] Update sandboxes to 19 RC (#7196) * Update transition docs for React 19 (#6837) * Add async transitions to React 19 docs * Updates from feedback * tweaks * grammar * Add startTranstion API * Apply suggestions from code review Co-authored-by: Noah Lemen <[email protected]> * Updated * capitalization * grammar --------- Co-authored-by: Noah Lemen <[email protected]> * [19] Add docs for prerender APIs (#7320) * Add prerender APIs * fix code blocks --------- Co-authored-by: Noah Lemen <[email protected]>
Overview
This PRs re-names "Server Actions" to "Server Functions" in the docs starting in React 19.
If you review the changes here, you can actually see the reason this makes sense: Many of the calls to "use server" functions are not actions.
For example, this example from the Server "Action" docs is not an Action:
This is just calling a server function on click. Really, it should be converted to an Action for better UX.
What are Server Actions then
Server Actions are Server Functions used in an Action context. For example, there are three examples on the Server Function page in this PR that show:
useActionState
Redirect
This change redirects links to "/server-action" to the 18 docs, which I'll add a callout for saying it's been renamed. We should also probably update the 19 blog post with a note about the name change.