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
Tag: graphql
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:
Programatically generating Gatsby pages without a slug from Graphql
I have set up an ACF options page in WordPress called Projects Inside the Projects options page there is an ACF repeater allowing the user to add multiple Projects. In Gatsby, I’m using Graphql to query the data for my Projects in two files: Inside a custom hook, allowing access to the data globally in my Gatsby site Inside a
Get an array of items from an object- typescript
I have an object with the below structure: the order is of type Order[] and users of type UserData[] Whenever I try to get the list of users per order : let users = this.Order.users it says that: users don’t exist on type Order[], can anyone explain for me why. Answer Order is an array of objects, you need to
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
unknown directive “@isAuthenticated”. Using Neo4j and Graphql
I’m trying to do something like this : but when I do that in my graphql.schema : I get this error : how am I supposed to add the directives? Answer The right way to do that with Neo4jGraphql was : see this doc for more informations : https://neo4j.com/docs/graphql-manual/current/auth/
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 https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization#creating-type-definitions 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
gatsby-image-background using v3 gatsby-image
I am trying to make gatsby-background-image work with v3 of gatsby-plugin-image. I have followed documentation and found I should be using gbimage-bridge. For some reason it doesn’t seem to work. My …
Getting TypeError on prerendering page in npm run build
I am prerendering this page on my Next.js application: Using getStaticProps() Using getStaticPaths() When I run it locally it works fine but when I try to deploy it with npm run build it gives an error just for the title property only: This is the part that confuses me as I don’t understand why the error is only on 1
SASS Applies style to the whole website despite only imported into a single page
I’m trying to apply a SASS file on one single js page, but the import goes on the whole website. Here is my partner.sass file : html, body, .media article,img p animation-name: fade-in animation-…