How to keep track of multiple running mutations with same function but different input variables?

I have a single mutate function that's basically: const doWork = api.example.doWork.useMutation() And I call it from a bunch of buttons with doWork.mutate{taskId: <someNumber>} This works in executing tasks in parallel, but I can no longer use doWork.isLoading to prevent users from submitting the same tasks multiple times before they resolve. My best bet was trying to put a list of active task ids in state and then clearing ids from the list in doWork.onSuccess, but now I have issues with inconsistent state / race conditions. Am I on the right path and just need to update my setState or is there a better way of doing this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server