Questions

  • Why I got error: Cannot query field xx on type “Query”?

    57 Although I copied and pasted the graphQL query from the GraphiQL tool after I tested it at GraphiQL successfully , the query returned with an error when I tried it in Apollo client within a reactJS app: [GraphQL error]: Message: Cannot query field “allStudents” on type “Query”., Location: [object Object], Path: undefined Here is […]

  • How to make the ApolloClient useQuery method to await

    0 const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const [getInvoiceDetails, { loading, data: invoiceDetails, refetch }] = useQuery(GET_INVOICE_DETAILS); const redeemHandler = async () => { try { const redeemItem = await redeemEarnableItem(); const id = redeemItem.data.redeemEarnableItem.invoiceID; console.log(id, […]

  • GraphQL usage with REST Endpoints in .Net core 6.0

    0 Since I am new to GraphQL, I don’t really know how to call a REST Endpoint and query the fields accordingly. In particular, I want to fetch certain fields from the entire response of a GET API. What I have learnt is GraphQL sends a POST Request. How do I hit the GET endpoints […]

  • GraphQL only select items of certain type from array

    0 In my GraphQL API I have defined a course fragment with an array property lessons. Initially it only had lessons of type TextLesson. Later we added lessons of type VideoLesson as well. fragment TextLessonFields on TextLesson { title body } #fragment VideoLessonFields on VideoLesson { # title # videoUrl #} fragment CourseFields on Course […]

  • onCompleted of Apollo’s useLazyQuery does not get called when the execute function resolves

    0 I am facing a problem with the following snippet: const [execute] = useLazyQuery(gql` query Example($id: String!) { node(id: $id) { … on Train { id passengers(first: 1) { totalCount } } } } `) useEffect(() => { execute({ onCompleted: () => console.log("Hello world") }) }, []) interface Node { id: ID! } type PassengerConnection […]

  • How to use Apollo’s multiple useQuery() hooks in React

    2 I need to use 2 queries in my file and I am writing them like so: const {loading, data } = useQuery(getCharactersQuery); const {loading, data} = useQuery(getSingleCharacterQuery); The problem is, they both have the same "loading" and "data" variables and I don’t see anywhere in the docs how can we have different ones. How […]

  • Emulating signed integers using unsigned integers in C

    11 In Jens Gustedt’s book Modern C, on page 59, he explains how signed integers can be emulated using unsigned integers. His example code shows how one can implement a comparison of two unsigned integers reinterpreted as signed integers: bool is_negative(unsigned a) { unsigned const int_max = UINT_MAX /2; return a > int_max; } bool […]

  • GraphQL mutation issue with Enum

    0 I have object something like below: type SomeEventInput { event: Event } type Event { type: EventType! } enum EventType { MORNING EVENING AFTERNOON MIDNIGHT } Mutation.SomeEvent(input: SomeEventInput!): Boolean! What i am trying to test it something like : mutation SomeEvent($input: SomeEventInput!) { SomeEventInput(input: {Event: {type: MORNING}}) } But it is showing error for […]

  • Laravel Lighthouse / Apollo Client React not sending auth cookies

    0 I’m creating a Laravel / React SPA Application using Sanctum Stateful Auth. I’n my local enviroment it works just fine. Cookies are being sent and everything is ok, but when I pass the app to production ( I’m using a shared hosting ). The stateful auth breaks and doesn’t work. It allows me to […]

  • How to embed nullable relations in ApiPlatform using GraphQL

    0 I am creating an API with ApiPlatform v3.2.1 and make use of the GraphQL features to query the API. How can I make it possible to use nullable embedded relations? For example I have an entity "Ordering" and nullable one-to-one related entities "ProductFoo" and "ProductBar". "ProductFoo" and "ProductBar" relation to "Ordering" is not nullable […]