server action split tasks
Genuine question, if you want a server action A that doesn't block your UI,
action does 1, 2, 3, 4 task,
ui only needs 1, 2 to render, it calls action A
how can I rendered the UI, make sure 3, 4 is done after the UI is rendered?
7 Replies
does next block until the response is made?
@Lois (Rustular CRHO)
your
return
UI won't get rendered until the server action is finishedi just checked and you can't stream responses back as well
if you aren't self hosting, you use can the waitUntil from vercel
idk it works outside of lambdas
if you are running on docker, just don't wait for the 3rd and 4th promise
should work
yep
i don't understand this
task 1 and task 2 here both running on the action
POST / 200 is the response
task 3 and task 4 here finished after the response was sent
if you deploy on vercel, you need to use the "waitUntil" feature of their platform
uhh I am on Railway ðŸ˜
you can use like this then
you should check if it works