sever action blocking ui/split task
Unanswered
Lois posted this in #help-forum
LoisOP
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 UI but calls action A
how can I rendered the UI, make sure 3, 4 is done after the UI is rendered?
action does 1, 2, 3, 4 task,
ui only needs 1, 2 to render UI but calls action A
how can I rendered the UI, make sure 3, 4 is done after the UI is rendered?
5 Replies
Why is server actions responsible for your ui rendering
@Lois
Server actions are for mutations
Aka your ui is what calls it when a user does something
@Lois 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 UI but calls action A
how can I rendered the UI, make sure 3, 4 is done after the UI is rendered?
maybe try this?
it probably works
"use server";
export async function action(formData) {
await task1();
await task2();
// fire and forget
task3().then(() => task4());
return ...
}it probably works