Best way to call an `authenticatedQuery` from another `authenticatedQuery`
I've defined a
customQuery
as follows:
This works great in cases when I call this query from the client, but if I want to call this query from another authenticatedQuery
it feels a bit clunky and double work is required to create the custom context, when ideally it could just be passed around.
Looking for advice on the cleanest way to do this 🙏3 Replies
Declare
and pass the custom ctx around.
Queries don't allow calling other queries directly (relevant docs: https://docs.convex.dev/functions/query-functions#splitting-up-query-code-via-helpers)
Queries | Convex Developer Hub
Queries are the bread and butter of your backend API. They fetch data from the
Thanks! I guess this would be the recommended approach for calling an
authenticatedMutation
from an authenticatedQuery
as well?
and viceversa too?You can declare helpers that are used from queries and mutations, yeah. (helpers that write to the db cannot be used from queries)