Tag: react-apollo
-
CORS blocks mutation in GraphQL Yoga
6 I am working here with a graphql prisma backend and a graphql yoga express server on top of that. In the frontend, I am trying to call a signout mutation but its blocked by the CORS policy. Though I have added cors settings in my graphql yoga server, I keep getting this error. GraphQL…
-
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…
-
GraphQL query is not returning the data at the first fetch itself
0 In my NextJS application, I’m using Apollo Client to query the data. This is the code, //Redeem earnable item const claimableItemId = "5ab7c5ab-7a3d-4a92-a62f-2fbd995955f6"; const destAddr = "0x387961b46242A42B445D4354d5048329410613a7"; const [redeemEarnableItem, { data: redeemItem }] = useMutation( REDEEM_EARNABLE_ITEM, { variables: { claimableItemId, destAddr, }, } ); const { loading, error, data: invoiceDetails, } = useQuery(GET_INVOICE_DETAILS, {…
-
Why state not updating from useMutation?
0 I’m trying to update state(useState) from useMutation(Apollo Client) callbacks, but it is not updating the state. Setting it inside "error" callback. Getting error in console: Warning: Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions…
-
why polling of Apollo useQuery don’t call onCompleted?
1 I am playing around the code: https://codesandbox.io/s/restless-framework-uldf4q?file=/src/App.js import React, { Fragment } from "react"; import { gql } from "apollo-boost"; import { useQuery } from "@apollo/react-hooks"; const GET_DOG_PHOTO = gql` query Dog($breed: String!) { dog(breed: $breed) { id displayImage } } `; const breed = "dingo"; const App = () => { const [count,…
-
module.export = {} with Vite React
0 I created a react App with Vite, and I want to use Apollo extension to get Intellisense when building GraphQL queries. According to the extension docs, I created an apollo.config.js file at the root with this code : module.exports = { client: { service: { name: "my-graphql-app", url: "https://localhost:4000/graphql", }, }, }; But since…
-
Apollo client modify.cache after receiving data from the subscription sometimes the cache does not update with new data
0 I am updating the real-time status of the product data with a subscription. Here is my code useProductSubscription({ varibales: { ids: productIds }, onData: ({ data }) => { const dataUpdated = data.productUpdated; if (!dataUpdated) return; const { productId, status } = dataUpdated; cache.modify({ id: cache.indentify({ __typename: ‘Product’, id: productId, }), fields: { status:…
-
Apollo extension config module.export = {} with Vite React
0 I created a react App with Vite, and I want to use Apollo extension to get Intellisense when building GraphQL queries. According to the extension docs, I created an apollo.config.js file at the root with this code : module.exports = { client: { service: { name: "my-graphql-app", url: "https://localhost:4000/graphql", }, }, }; But since…
-
Read cache from a different request field
0 With React Native and Apollo client, I am am trying to properly write and read cache from a different request field. I basically ave two object types : ‘User’ & ‘Event’, and I have those " requests : All the events : (Event List screen) events { id numberOfParticipants } Connetced user with events…
-
Remove read-only fields before mutation in GraphQL
10 I’ve got a type called Article in my schema: type Article { id: ID! updated: DateTime headline: String subline: String } For updates to it, there’s a corresponding input type that is used by a updateArticle(id: ID!, article: ArticleInput!) mutation: input ArticleInput { headline: String subline: String } The mutation itself looks like this:…