jeffJ
Convex Community2y ago
59 replies
jeff

Best-practice for (mutation+action) function?

Hi! 👋
Brief question:

When I need, in response to a client's clickety-clicking, to:
a) write some changes to the DB; and
b) call some external APIs (using custom libraries)

Is it better practice:
* to call an Action from the client, and runQuery within the action as needed; or
* to call a Mutation, and then... I guess schedule an action?

I strongly assume the former, now that I've typed it out—but would appreciate feedback anyway!
What's the best way to achieve only-once'ness/atomicity? A semaphore table maybe?

Thanks!
Was this page helpful?