#Use helper functions or internalAction?

3 messages · Page 1 of 1 (latest)

chilly widget
#

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?

#

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?

nova fern
#

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.