We use GraphQL for simplified, structured query writing for interfacing with the the data via our API. To achieve this we write our queries and mutations using the GraphQL syntax and then run a script via the command line to generate the necessary functions for retrieving and manipulating the data on the backend through the API.
This document describes the process of updating queries and mutations with new properties from our hosted schema.
We need to update all affected queries and mutations with the affected property in our preflight, whether we’re adding, removing or updating one. Here are the steps to follow:
src/graphql directory and exclude the graphql/generated directory to declutter the results)cd into the root directory of your project and run the following commandnpm run codegen
graphql/generated directory)graphql/generated/graphql.tsx file where codegen has not imported the functions from the correct packages. These need to be updated as follows for the time-being:import * as ApolloReactCommon from '@apollo/react-common' => '@apollo/client';
import * as ApolloReactComponents from '@apollo/react-components' => '@apollo/client/react/components';
import * as ApolloReactHoc from '@apollo/react-hoc' => '@apollo/client/react/hoc';