Skip to content

Tag: graphql

Apollo Client useQuery making un-necessary refetches upon Next.js router.push

I’m dealing with an issue in which a query inside a useQuery Apollo Client hook is getting un-necessarily re-run whenever Next.js’s router.push (docs here) is called. The abbreviated code is: You can see a reproduction on CodeSandbox here. My expectation is that whenever the button is clicked (and thus router.push is called), the query shouldn’t be re-run. However, it’s re-run

Error: No “exports” main defined in graphql-upload/package.json

Have installed graphql-upload, do import { graphqlUploadExpress } from ‘graphql-upload’; And getting this error: Error: No “exports” main defined in graphql-upload/package.json Dependencies: The version of node: v16.10.0 Answer So the problem was in the .default build settings. You can remove it, but when we removed it we saw the problem with other modules, so we resolved this issue via this:

Saving the state of the button onClick

I have: This pattern works fine, but whenever on the page more then 1 attribute and user select more then one, previously selected button gets unclicked. My question is: How can I save the state of 1st selected button after clicking on 2nd one? for each attribute only one button can be active buttons name should be used Answer You

How to create schema customization to use optional field “featureImage” from gatsby blog

I’m making a Gatsby blog as a side project. I want to use the “featureImage” optional field in mdx frontmatter. I tried to refer to the document according to the error message, but it was difficult to understand. This is part of my code. index.js gatsby-node.js I tried this and it works when featureImage is not present. But if