Next.js innovation vs stability: Server Actions still lack parallelism and abort capabilities #84893
Replies: 2 comments 4 replies
-
|
Hi,
There's a whole set of issues arising from concurrently running mutations, that can be controlled by queuing the mutations. Server Actions are primarily for mutations, and it is often the case that concurrent execution is needed when fetching data.
That being said, two improvements will eventually be added, source:
Regarding a mechanism to abort Server Actions, I don't have a good answer. We have to start from Server Functions/Actions being a React Server Components feature, not necessarily just a Next.js thing, although they are implemented by the framework. So, this kind of feature would have to be considered from the RSC point of view. A Server Action is an opinionated way to mutate data, by triggering some server side work. When this model doesn't fit, you have escape hatches provided by Next.js, such as Route Handlers, where you can do this. How do we even model this. Most are thinking about just cancelling/ignoring from the client, but we'd also need to make the signal/event available to the server function, so that you can release resources, etc... When fetching data, cancelling at any point is fine, but when mutating data... when the cancellation happens matters a lot 🤔 |
Beta Was this translation helpful? Give feedback.
-
|
Great points — totally agree that Server Actions still need improvement in concurrency and abort control. From what I’ve seen, the current limitation comes from the single-threaded execution model and the way React’s async context is handled inside the Server Actions runtime. They’re essentially queued, not parallelized. Abort support will likely depend on better integration with AbortController at the React/Edge runtime layer. Until that lands, using APIs or background workers for parallel operations is the most stable workaround. Definitely hope future Next.js releases address this — these features are essential for production-grade workloads. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When Next.js 14 was launched, I was genuinely excited about the introduction of Server Actions. Initially, I didn’t realize the full implications of how they interact with API calls or concurrent operations. Later, I found that Server Actions cannot run on Server Components, which was expected — but what surprised me was that they also don’t run in parallel.⚠️
In my case, whenever one Server Action is running, other requests seem to get blocked until the previous one resolves. This behavior prevents parallel execution, and I’m unsure whether it’s caused by Next.js Server Actions themselves or by how TanStack Query integrates with them. 🤔
Another major limitation I noticed is that Server Actions cannot be aborted. ❌ For example, if I upload multiple documents 📄📄📄 and then decide I no longer need the uploaded files while the API calls are still pending, there is no way to cancel all ongoing Server Actions and start a new task. I have to wait until all existing Server Actions resolve before I can proceed, which is quite limiting in real-world applications. ⏳
Even after the release of Next.js 15, and with Next.js 16 on the horizon, these limitations still persist. ⏱️
It feels like the framework is evolving rapidly — which is great for innovation ✨ — but at the same time, existing features like Server Actions remain under-optimized or incomplete. As developers, we truly appreciate new capabilities, but we also hope to see stability and maturity in the features that are already part of the core framework. 🛠️
Are there any ongoing plans or discussions around enabling parallel Server Actions ⚡ or improving their runtime concurrency and abort capabilities before introducing new major features? ❓
Beta Was this translation helpful? Give feedback.
All reactions