Server actions
Answered
Miniature Schnauzer posted this in #help-forum
Miniature SchnauzerOP
Given that there's a lot of advice saying you shouldn't use server actions to fetch data, I'm wondering if it's okay to query my db as part of a transaction to perform the mutation I want.
Answered by B33fb0n3
yes, that would be ok. Most of the fetching is for example: when you want to query your db with server actions, it is technically possible, but each server action would run after another. There wouldn't be any parallel rendering.
So in your case: you fetch something inside the server action to use that inside the same server action, it would be fine
So in your case: you fetch something inside the server action to use that inside the same server action, it would be fine
3 Replies
@Miniature Schnauzer Given that there's a lot of advice saying you shouldn't use server actions to fetch data, I'm wondering if it's okay to query my db as part of a transaction to perform the mutation I want.
yes, that would be ok. Most of the fetching is for example: when you want to query your db with server actions, it is technically possible, but each server action would run after another. There wouldn't be any parallel rendering.
So in your case: you fetch something inside the server action to use that inside the same server action, it would be fine
So in your case: you fetch something inside the server action to use that inside the same server action, it would be fine
Answer
Miniature SchnauzerOP
Thank you!
happy to help