Tag: #reactjs
-
How can I use debounce to avoid triggering the graphQL query on every keystroke in react?
0 I was given a new task and I have to debounce the input value to prevent a backend request on each keystroke and on the other hand CollectionsAutocomplete should have an internal useState with an input value, that is linked to the generalQuery variable. Right now I was able to add the internal useState…
-
Is there a more efficient way to call multiple apis using graphql and react
0 I am using GraphQL and react on my client side project but I am not using a state management system like Redux I have organised my api calls into custom hook files like below const [getSomeData, { data: getSomeDataData, loading: getSomeDataLoading, error: getSomeDataError }] = useLazyQuery( GET_SOME_DATA2, { client: dataClient, fetchPolicy: "cache-and-network", nextFetchPolicy: "cache-first",…
-
useMutation does not work from react front end but works in apollo client with same variables Mutation.js
0 I am trying to executate a mutation called createGroup, when i do it graphQl apolo clients it creates the group in firebase collection successfully but in the react frontend it does not work. When the create button is clicked in the appolo dev tools it shows as mutation started but nothing happens on firebase.…
-
How to update apollo cache
0 I am wondering why it’s very hard to update a data inside of apollo client cache, comparing to similar libraries like react-query it’s too complicated For example, When I have a query with pagination (offset and limit) and get an array of items, When I perform a mutation on one item , and from…
-
loading queries from .graphql files and use them with apollo client and react
0 Hi guys basicalle I’m creating an app using react, graphql and apollo client, currently I,m loading the queries from a .tsx file with this kind of structure const MULTIPLE_WELLS_FROM_TAO2 = gql` query { query_multiple_wells_from_tao2db { selected_well { opru_fld_nme { value } prod_govt_lse_nbr { value } well_cmpl_seq_nbr { value } } } } `; and…
-
Call graphql query from form submit
0 I have a simple react app like const [shoe, setShoe] = useState(”) formSubmit = () => { e.preventDefault() const { data } = useQuery<GetShoeDetailsQuery,GetShoeDetailsQueryVariables>(getShoeDetailsQuery, { variables: { name: String(shoe), }, }) console.log(data) } <form onSubmit={formSubmit}> <input type="text" onChange: (e: { target: { value: SetStateAction<string> } }) => { setShoe(e.target.value) }, > <button></button> </form> so…
-
How to use AWS Amplify GraphQL search and aggregate queries in React code?
0 In the current AWS Amplify React documentation there are no any examples showing how to use these GraphQL queries in React code. Can someone please post an example here. Authentication method needs be the API_KEY. Thanks. query SearchStudentsByEmail { searchStudents(filter: { name: { eq: "Rene Brandel" } }) { items { id name email…
-
Error: Gatsby query was left in the compiled code while testing with vitest
0 I am working on a Gatsby website and while testing a component with a graphql query using vitest I keep getting this error : Error: It appears like Gatsby is misconfigured. Gatsby related graphql calls are supposed to only be evaluated at compile time, and then compiled away. Unfortunately, something went wrong and the…
-
@graphql-codegen/typescript-react-query not generating object format for useQuery
-1 I am using @graphql-codegen/typescript-react-query to generate typescript from my graphql schema. these are my @graphql-codegen dependencies "@graphql-codegen/cli": "^5.0.0", "@graphql-codegen/typescript": "^4.0.1", "@graphql-codegen/typescript-operations": "^4.0.1", "@graphql-codegen/typescript-react-query": "^6.0.0", "@graphql-eslint/eslt-plugin": "^3.19.1", my generation configuration is: "schema.ts": { plugins: [ "typescript", "typescript-operations", "typescript-react-query" ], config: { enumValues: enumValues, exposeDocument: true, exposeQueryKeys: true, exposeMutationKeys: true, exposeFetcher: true, addInfiniteQuery: true } }…
-
Variables of required type not provided despited their validity
2 I’m getting a GraphQL error I can’t seem to pinpoint the source of. Variable “$title” of required type “String!” was not provided. Variable “$body” of required type “String!” was not provided. Variable “$price” of required type “Int!” was not provided. The error message is simple. There are three required variables for this mutation and…