Query causing infinite loop #1565
Answered
by
JoviDeCroock
Utkarshbhimte
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
JoviDeCroock
Apr 25, 2021
Replies: 3 comments 7 replies
-
What are you passing in into the |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
kitten
-
what do you mean by both APIs? |
Beta Was this translation helpful? Give feedback.
4 replies
-
This is my nexus file. import { extendType, objectType, stringArg } from "nexus";
import prisma from "../../db/prisma";
const Subscription = objectType({
name: "Subscription",
definition(t) {
t.model.id();
t.model.course();
t.model.user();
},
});
const queries = extendType({
type: "Query",
definition: (t) => {
t.field("subscription", {
type: "Subscription",
args: {
courseId: stringArg(),
},
resolve: async (_, { courseId }, ctx) => {
if (!ctx.user?.id) return null;
const course = await prisma.subscription.findFirst({
where: {
userId: ctx.user.id,
courseId: courseId as string,
},
});
if (!course) return null;
return course;
},
});
},
});
const mutations = extendType({
type: "Mutation",
definition: (t) => {
return null;
},
});
export default [Subscription, mutations, queries]; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are you passing in into the
options
? Is any of those an unmemoizedcontext
object by any chance?