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
Neto
Neto•7mo ago
does next block until the response is made? @Lois (Rustular CRHO)
Lois
LoisOP•7mo ago
your return UI won't get rendered until the server action is finished
Neto
Neto•7mo ago
i 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
Lois
LoisOP•7mo ago
i don't understand this
Neto
Neto•7mo ago
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
Lois
LoisOP•7mo ago
uhh I am on Railway 😭
Neto
Neto•7mo ago
you can use like this then you should check if it works
Want results from more Discord servers?
Add your server