next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Docs: inconsistent usage of "server function" and "server action"

Open mintydev789 opened this issue 7 months ago • 7 comments

What is the documentation issue?

The documentation for Server Actions and Mutations is inconsistent both with the React docs and with Next JS's own How to update data page. I have noticed that this has created confusion in the community about what is a server function and what is a server action.

Is there any context that might help us understand?

The React docs state: "Add 'use server' at the top of an async function body to mark the function as callable by the client. We call these functions Server Functions."

The Next JS How to update data page correctly states: "A Server Function is an asynchronous function that is executed on the server. [...] When invoked as part of an action, they are also called Server Actions." So here we see the correct nuance: server function is the more general term and we find out that some server functions are also server actions.

But then the Server Actions and Mutations incorrectly states: "Server Actions are asynchronous functions that are executed on the server." This indicates that "server action" is the more general term, which isn't true anymore. This seems to be referring to the old terminology that was used before this technology became more stable.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations

mintydev789 avatar May 29 '25 13:05 mintydev789

👋 Hi! I'd like to work on this documentation issue.

I’ve noticed the terminology around Server Functions and Server Actions is inconsistent across the Next.js docs and React docs. I'd like to help clarify this in the Server Actions and Mutations page by aligning with the latest React terminology.

If no one else is working on this, I’ll start a PR soon. Thanks!

Mahe9041 avatar May 29 '25 14:05 Mahe9041

👋 Hi! I'd like to work on this documentation issue.

I’ve noticed the terminology around Server Functions and Server Actions is inconsistent across the Next.js docs and React docs. I'd like to help clarify this in the Server Actions and Mutations page by aligning with the latest React terminology.

If no one else is working on this, I’ll start a PR soon. Thanks!

Umm, I'll be honest, that really looks like an AI account...

mintydev789 avatar May 29 '25 14:05 mintydev789

Sorry for that, i just took help from chatgpt to rewrite the message properlly.

Mahe9041 avatar May 29 '25 16:05 Mahe9041

My approch is as below :

I will replace the text in Doc with the below : - >

Server Functions are asynchronous functions that are executed on the server.
When used as part of a form submission or mutation workflow, they are referred to as Server Actions.

Note: Server Actions are a specific use case of Server Functions that can be invoked from the client using use server.

Mahe9041 avatar May 30 '25 03:05 Mahe9041

We've been doing some alignment here. There should be some updates coming up soon.

icyJoseph avatar May 30 '25 09:05 icyJoseph

Any update on this?

mintydev789 avatar Dec 11 '25 10:12 mintydev789

I have a PR open, not sure it lands enough changes for this issue though https://github.com/vercel/next.js/pull/86827 - always open to feedback/comments

icyJoseph avatar Dec 11 '25 12:12 icyJoseph