Skip to content

Tag: apollo

ApolloError: Fragment was used, but not defined

I have this in my complicated app: Basically, I have an export button which will export a CSV of my GraphQL data. I manually call client.query to fetch the latest data on click of the button, but it throws an error saying it can’t find the used fragment StuffTable. How do I include that fragment in the …

Apollo fetchMore updates data globally

I have two TaskList components that use the same query GET_TASKS. Both use a different filter query variable which is passed down to them in props as queryVars. I defined a standard merge function in type policies to merge the incoming and existing data together. The TaskList component uses to retrieve the da…

Return multiple queries using Apollo

I am using nextJS for my frontend with apollo and a graphql. And I fetching my queries using the getStaticProps() function. To increase modularity and maintainability I break my queries into multiple queries. I have a folder structure like: src/queries getPost.js getMenu.js getProduct.js index.js And their al…

How to run useQuery inside forEach?

I have loop – forEach – which find productId for every element of array. I want to fetch my database by productId using apollo query. How to do it? Answer From the rules of hooks: Don’t call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the top level of your Rea…