T
TanStack4d ago
flat-fuchsia

is there a way to know if there are any async mutations in-flight for a collection?

I want to block mutations in the brief period that an async mutation is in-flight for one of my larger forms. It's mainly to prevent the race condition where an onUpdate handler gets processed before the onInsert. In this case, an upsert is not possible, the insert '''must''' happen before the update. Is there a way to access like a pendingMutations integer or a isMutating flag for a collection ? This would tremendously help in my opinion thank you in advance
1 Reply
flat-fuchsia
flat-fuchsia4d ago
Hmm interesting. Perhaps paced mutations with the queue strategy is what you want? https://tanstack.com/db/latest/docs/guides/mutations#paced-mutations
Mutations | TanStack DB Docs
TanStack DB Mutations TanStack DB provides a powerful mutation system that enables optimistic updates with automatic state management. This system is built around a pattern of optimistic mutation → ba...

Did you find this page helpful?