3,371 questions
Best practices
0
votes
0
replies
15
views
Apollo Client Cache Update Strategy for new object mutations
I’m trying to find an effective way to introduce newly created “second class” objects into the InMemoryCache. By “second class”, I mean objects that depend on a parent object. When I’m creating these ...
0
votes
1
answer
66
views
How to fix Apollo Client v4 in Expo?
I have a problem with migrating from Apollo client v3 to v4 and i get this error
Warning: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite ...
1
vote
1
answer
202
views
Generated file uses skipToken import incorrectly in Next.js App Router
I’m using Apollo Client v4 (4.0.5) with Next.js App Router and GraphQL Code Generator (typescript-react-apollo) to generate TypeScript types and hooks for my GraphQL API.
Everything was working fine ...
0
votes
1
answer
78
views
is it possible to generate typing for the cache object of apollo client mutation?
I’m using graphql-codegen with apollo-client. Everything works great except one thing:
I tried to update cache after mutation, the update function of client.mutate doesn’t have typings for the cache ...
2
votes
1
answer
191
views
Inserting ' $fragmentrefs` into generated types when using Apollo GraphQL fragments
I recently started using Apollo Fragments for the first time to synchronize parts of schemas between queries and mutations instead of manually keeping those schemas synchronized.
However, now ...
1
vote
1
answer
145
views
Cannot import @apollo/client in Vinxi/Vite/Tanstack Start
The following line works fine in the browser and in Bun:
import { ApolloProvider } from "@apollo/client";
but when I run it in SSR (inside Tanstack Start / Vite / Vinxi) I get an error ...
0
votes
0
answers
57
views
Connection to the Express/Apollo Server fails from certain networks
I have a React frontend using Apollo Client to interact with a backend GraphQL server. The GraphQL server is a Node.js application utilizing Express and Apollo Server, and it communicates with ...
0
votes
0
answers
42
views
useQuery with useEffect not causing infinite re-render
I have below code snippet:
const [state, setState] = useState(null);
{data, loading, error} = useQuery(SOME_QUERY, {fetchPolicy: 'no-cache'});
useEffect(() => {
setState(data)
}, [data]);
This ...
0
votes
0
answers
30
views
Are inline fragments recommended for GraphQL for native mobile app consumption?
New to GraphQL. Working on designing integration for native mobile app (kotlin/swift).
Planning to use Apollo GraphQL
Architecture:
native app(app) -> graphQL server (server) -> REST endpoint (...
0
votes
1
answer
37
views
setContext not setting the token call before API call when token expires
Token API should get called before the GraphQL API but it's being called at the same time
I am fetching the headers inside setContext
Inside commonAuthHeaders I am calling the API to get refresh token
...
1
vote
1
answer
73
views
Apollo client cache returns a bad data
First, I call useGetData with parameters that include filters for test1 and test2 (this is correct). The data is fetched and stored in the cache. Then, I disable the test2 filter and make a new ...
1
vote
0
answers
14
views
Cannot throw specific error to the frontend from backend in apollo/spring app
I want to throw a custom exception from the my reactive spring-boot backend to the browser front end over graphql apollo. I want to front end browser to know about the specific information in this ...
1
vote
0
answers
42
views
Unknown logs in registered persisted query
I am trying to implement registered persisted query. when i am running a query which is not there in my PQL, with apq as enabled it is logging the query in router logs with error code “...
0
votes
1
answer
85
views
Vue 3 apollo client UseLazyQuery for multiple results
I am trying to run the useLazyQuery in my vue to get data from Apollo client. I am passing the parameter and query return different results based on the parameter being passed.
My issue is that result ...
0
votes
1
answer
226
views
How to implement cursor based pagination when elements can be deleted, which can invalidate the stored cursor?
I have a GraphQL query which looks like so
query Person($cursor: ID, $limit: Int) {
items:{
...
}
name
...
cursor
}
While making the query for the next page, I fetch using the returned ...
0
votes
1
answer
52
views
After some requests it losts the cookies and gives GraphQL Error "Cannot read properties of undefined (reading '_id'). "
I am using Query and resolver for fetching the articles data. In one request it fetches the 15 records. Fetching data limit is 15. After some request it lost the user Info/cookies an gives error ...
1
vote
0
answers
63
views
apollo-client-maven-plugin: How to flatten fragments in generated models
I'm using the apollo-client-maven-plugin version 7.1.0, and I'm trying to flatten fragments in my response models, but I'm encountering an issue where the fragments are wrapped in a nested object.
...
1
vote
1
answer
698
views
NextJs Error at build: ApolloError: Dynamic server usage. Couldn't be rendered statically because it used revalidate: 0 fetch
When we build nextJs yarn build when it goes to the step Generating static pages we have this error:
Error occurred prerendering page "/partners/partner-with-us". Read more: https://nextjs....
3
votes
1
answer
1k
views
Why does querying Strapi with "DRAFT" status return both published and drafted items in GraphQL?
I'm using Strapi as a headless CMS with the Draft & Publish feature enabled, and I'm querying the data using GraphQL in my project. The problem I'm facing is with filtering drafted and published ...
0
votes
1
answer
430
views
apollo useSuspenseQuery causes non-stop rerenders
I have the below component -LocationStats- running a suspense query. The query causes non stop re-renders. I can see it sends a query to the server, and the minute it gets a response, it launches the ...
0
votes
1
answer
45
views
Apollo Client is refetching a query after an add mutation but not a delete
I have a mutation that adds a todo to a list of todos.
mutation AddTodo($data: AddTodoInput!) {
addTodoToList(data: $data) {
id
todos{
...
0
votes
1
answer
207
views
Use GraphQL Documents on Apollo Client queries
I have created a Rest API application in Typescript, using NestJS and querying a GraphQL server using Apollo Client.
I currently have my queries hard-coded like this:
const query = "query { ...
1
vote
1
answer
42
views
Unable to call getStaticProps
I am trying to fetch menu items from WordPress through Apollo client, but my getStaticProps function never gets called.
Here is what I currently have as my setup:
Navbar.jsx src/components/Navbar
...
0
votes
2
answers
186
views
Set header in graphql
I want to set auth in req header to specific value but after I tried different methods and check req from browser my key is not in the req header
I am using Reactjs ,vite ,@apollo/client and running ...
-1
votes
1
answer
94
views
'npm run dev' result: [Error: ENOENT: no such file or directory, open '/ddev/project-name/node_modules/@vue/apollo-composable/src/useApolloClient.ts']
I took over a Craft CMS project, which I successfully upgraded to the latest version of Craft 5.
When I run the command needed to build the JS and CSS files
npm run dev
I get the following error:
...