#Can internal query be recursive?
3 messages · Page 1 of 1 (latest)
The handler can be recursive.
function qHandler(ctx, args) {
// do some stuff
qHandler(ctx, args);
// more stuff
}
export const foo = internalQuery({args: {...}, handler: qHandler });
calling the query itself recursively involves overhead for argument validation and making it into a transaction, so I wouldn't recommend it even if it were possible. Making the handler recursive or calling a recursive function from the query is usually better