In part of my application I need to save an item state to the server. However sometimes I will trigger a chain of submits each about 10ms away from the other.
State A
State B
State C
State D
In this case I should really only submit State D.
My current solution is to have a takeLatest() on a saga with
function* submitItemStateSaga(action: Action<SubmitItemStatePayload>) {
yield call(delay, THROTTLE_MS);
//saga body
}
This seems kinda of hacky to me. Do you think this is okay, or is there a better way to do it using the inbuilt throttle() function.