Questions tagged [react-apollo]

React Apollo allows you to fetch data from your GraphQL server and use it in building complex and reactive UIs using the React framework. React Apollo may be used in any context that React may be used. In the browser, in React Native, or in Node.js when you want to do server-side rendering.

react-apollo tag should be used for questions that are about the usage of the react-apollo ApolloClient container.

It should be included with the apollostack (and related) tags to clarify that this is the client wrapper being used.

It alleviates the need to use the , which should not be used, unless a person who knows nothing about react-apollo is likely to be able to answer the question.

Related tags

2335 questions
0
votes
1 answer

cache.writeData is not a function -> inMemoryCache error

I'm working with react and apollo client. i'm get confusing error and i can't find exactly the problem. i have the code. import logo from './logo.svg'; import './App.css'; import Pages from './pages'; import GlobalStyles from…
0
votes
0 answers

Terminate a graphql request from Apollo Link

I have an ApolloLink setup for the AWSAppSyncClient in my React project to check if the user is authorized to make the graphql request. If the user is not authorized then, link should not invoke the forward method rather just return an Error for…
Nitesh
  • 1
  • 2
0
votes
0 answers

MockedProvider does not work when Component query changes

I have simplified problem into these files TestComp.tsx export const TestComp: FC<> = () => { const [testValue, setTestValue] = React.useState(5); const where = React.useMemo(() => testValue, [testValue]); const { data: productsData } =…
Jon Shkreli
  • 61
  • 2
  • 5
0
votes
1 answer

How to refetch/fetch after a series of mutation in graphql/apollo/react

Right now I have a use case to use two useMutations to create/update database. So the second one is depends on the success of the first one. And also the second mutation needs to be called in a loop, just think about that I have a array and I need…
Hongli Bu
  • 461
  • 12
  • 37
0
votes
0 answers

React component does not get new status if apollo cache is changed by updateFragment()

I don't understand why in same case when I change the apollo cache with updateFragment() the frontend does not receive the value changed. I have a component that fetch data using this query query Product_findByShopId($shopId: Int!)…
Webman
  • 1,534
  • 3
  • 26
  • 48
0
votes
0 answers

GraphQL: how to build a diff query

I'm new to GraphQL. I have a server API that only returns changes done to a list of objects since a certain timestamp given by the client. This is for performance reasons - so that polling will return a smaller result after the initial query. So the…
Sagi Mann
  • 2,967
  • 6
  • 39
  • 72
0
votes
1 answer

Mocked Apollo Provider with React testing library is not returning data

I've been trying to fix this problem for a couple days and I'm still at a loss. I have a React app that uses Apollo Client and I want to test one component with the React testing library. Omitting all the irrelevant details, my main file code looks…
Jean-Baptiste
  • 1,552
  • 1
  • 19
  • 33
0
votes
1 answer

Graphql gql with variables and Query component (deprecated)

I am trying to get use graphql with query component . const LOAD_PRODUCTS = gql` query { category(input :{title : "${category}"}){ name products { id name brand inStock gallery …
0
votes
0 answers

I want to change the cache after using useMutation

I have to change records of the cache so that the data will be displayed immediately after the mutation succeeded. But I'm not sure if I implemented the update function correctly. When the mutation trys to work the program says existingData is null.…
0
votes
0 answers

Creating a new ApolloError throws type error _client.ApolloError is not a constructor

I am trying to test a React component that uses a hook that calls Apollo useQuery. describe('when query returns an error', () => { beforeEach(() => { const apolloError = new ApolloError({ errorMessage: 'error' }) jest …
xeno9
  • 33
  • 4
0
votes
1 answer

Is their a way to just write to the cache without querying in apollo client?

Preface: With the addition of server-side components in react sometimes it makes sense to fetch some data on the server side, but I would still like to use the apollo client cache it seems like it is a waste to try to fetch data that I already have…
Wayne
  • 660
  • 6
  • 16
0
votes
1 answer

How to implement a filter on a query in Apollo?

I'm attempting to filter a query by a specific field. I can achieve this in Apollo explorer in dev tools but I can't seem to translate this into code. The following works in Apollo explorer: query ListUsersByType($filter: TableUsersFilterInput) { …
xeno9
  • 33
  • 4
0
votes
0 answers

Using multiple connections in Apollo Studio Sandbox

I use https://studio.apollographql.com/sandbox for all my local graphql development. I can connect to one connection and save operations for the connection. Is there any way, I can connect to multiple connections and save the operations? So that,…
confusedWarrior
  • 938
  • 2
  • 14
  • 30
0
votes
1 answer

Apollo paginated query using cache but still fetching from server (even though cache exists for query variables)

I have implemented a limit-offset paginated query in my server that I am querying from the front end. The pagination seems to work fine but caching is not working as I would expect it to. My assumption of the expected behavior is that when I request…
Oamar Kanji
  • 1,824
  • 6
  • 24
  • 39
0
votes
0 answers

How to generate Schema?

this is my gradle ,I use kotlin plus graphql import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { id("org.springframework.boot") version "2.7.5" id("io.spring.dependency-management") version "1.0.15.RELEASE" …
1 2 3
99
100