erquhart
erquhart13mo ago

Calling a mutation from a mutation

@Manomite asked:
Please does anyone knows how to reuse internal query in mutations... Or how can I reuse internalQuery or internalMutations in another export?
4 Replies
Manomite
Manomite13mo ago
Okay thanks... Am here
erquhart
erquhartOP13mo ago
Can you share the mutation? I can walk you through it. Otherwise I can throw up some pseudo code.
Michal Srb
Michal Srb13mo ago
If you need to reuse a piece of logic between multiple mutations write a normal JS function that takes MutationCtx and call it from your mutations. See https://docs.convex.dev/typescript#type-annotating-server-side-helpers
TypeScript | Convex Developer Hub
Move faster with end-to-end type safety.
Manomite
Manomite13mo ago
Ooohh... Am off the computer now... Probably tomorrow morning will paste the code... But a pseudo code could help too.. I will try this approach and see if it works then revert back... Thanks... Got this solved... Thanks...

Did you find this page helpful?