T
TanStack5mo ago
conscious-sapphire

How to check if form action (as server function) is running?

When setting a server function as action attribute on form-element, is there any way to determine if the action is currently running (like with useActionState from React)?
5 Replies
sensitive-blue
sensitive-blue5mo ago
How would that work? You would need a stateful layer that tracks server function executions and their parameters across all server instances.
conscious-sapphire
conscious-sapphireOP5mo ago
Is that so? I'm one client that submits a specific form that I want to track. I think that's exactly where useActionState (in React) is for?
sensitive-blue
sensitive-blue5mo ago
I might be misunderstanding your requirements. A few questions: * Do you want to check the action's status from the client or server? * Do you care about tracking actions initiated from other clients (i.e. the same user in a different browser tab or on a different computer)? * Do you care about tracking action state across refreshes? I.e. if the user refreshes their browser tab, should they still see the action as in progress?
conscious-sapphire
conscious-sapphireOP5mo ago
Hi! Thanks for coming back! I want to track the action's status from the client! And only the action initiated by "me". Think of a requirement where you want to disable a button or something else while the action is running (that was caused by the button click). Not sure if a transition could work here...
xenial-black
xenial-black5mo ago
I think there is a new React 19 hook for such actions

Did you find this page helpful?