Asynchronous Server Actions
Unanswered
Gouty oak gall posted this in #help-forum
Gouty oak gallOP
If I have code similar to the following (in client code)
I was expecting to see serverAction1 and 2 running in parralel, but it seems to queue them in the browser. Why?
const promise1 = serverAction1(x);
const resp2 = await serverAction2(x);
const resp1 = await promise1;I was expecting to see serverAction1 and 2 running in parralel, but it seems to queue them in the browser. Why?
3 Replies
Broad-snouted Caiman
You should use Promise.All, as explained in here: https://nextjs.org/docs/app/building-your-application/data-fetching/patterns#parallel-and-sequential-data-fetching
Gouty oak gallOP
Don’t think that is the issue but I’ll give it a shot. Seems like the calls to the server are queued up
Gouty oak gallOP
Yea, same behavior, I think it has something specific to do with server actions.