Use helper functions or internalAction?
I'm saving an image from an internal action.
Am I meant to call another internal action or can I just use a regular function?
What is the benefit of using an internalAction over a regular function?
3 Replies
Still wrapping my head around the convex best practices.
I'm guessing I should be avoiding Actions unless I NEED to use them is that right?
I would recommend calling a function directly when you can. This reduces overhead, since a new action would get a new javascript environment and serialize the args & return values.
ctx.runAction
is most helpful for switching between the convex runtime and node.js.
And you're right, actions should only be used when necessary. If you can do it in a mutation, that has even less overhead and better guarantees.Thanks, okay so should aim for mutations if possible otherwise a function and an action only when necessary.