T
TanStack10mo ago
conscious-sapphire

Aborting paused mutations

Is there a way to abort paused mutations with specific variables? E.g. I'm currently offline and I trigger mutation (which has own scope) multiple times. When I go online that mutations start calling mutationFn one by one. If one mutation in chain throw an error, onError handler rollbacks optimistic update. And in this moment I want to abort all further mutations with specific variables. Because next mutation probably will throw an error too and their context has already invalid previous value that should not be used for rollback.
1 Reply
deep-jade
deep-jade10mo ago
I think you'll have to provide a repoduction stackblitz/codepen of this case to get help on this. I know queries have the signal AbortSignal property in there QueryContext but mutations just get the input and that's it. So I don't think you can cancel in-flight mutations really.

Did you find this page helpful?