How to make sure a server action that runs onchange/onupdated starts from the beginning

Hi have a server action with calculations and table value updates and inserts that runs onchange of a range slider input field.

I have put a debounce of 600ms on the trigger, but it seems like when the server action is running and the user makes a change midway, the server action “reruns” but values updated tells me it does not start from the beginning. Maybe I am wrong.

Is the only way to prevent this by setting the input field to disabled while action runs? Or is there a way to ensure the action restarts completely?

I have never seen a case where a SA changes values midway.
Each run is completely new and ‘from the beginning’.
What you might be seeing is an overlap of SA execution.
So the first one starts, and before it finishes, the second request comes in. For some reason, the second request is completing first, then the first request - which is the only explanation I ca think of for incorrect updated values that you report.

Disabling the input has been the best option in our use-cases.

1 Like

Thanks. I use the disable on executing and it works great.

1 Like