7 Replies
I think easiest way is to factor the logic into a helper method and have both call it.
you can also just call it, but note that if you have any args type checking on the second query those types won't be enforced at runtime. they only get enforced when called by the convex runtime
perhaps we should add a
ctx.runQuery
from queries (like in actions) but we haven't done so since it's generally a better software development practice to use helper methods, i.e., just a regular function callyep
this works
but I like this way better
But whatever you like!
second way! 😉
im not sure i get why second is better but ok 🙂
thank you
second is better just because it's less ambiguous about what it means
e.g., if there was any arg validation in the first one then it would run on the sub-function, plus the sub-function doesn't run as a separate transaction, just within the context of the first transaction.
but functionally they are both the same, apart from looking less confusing
ah i understand now. Thank you!