apollo-client Questions
1
I'd like to mock an error response in graphql-tools/addMockFunctionsToSchema mock resolver following this pattern:
const mocks = {
...,
Mutation: () => ({
getToken: (_, { password }) => {...
Helfand asked 14/4, 2018 at 15:42
2
Solved
I use the useQuery Hook like this:
function Foo() {
const { data, error, loading } = useQuery(MY_QUERY, { pollInterval: 1000 });
return (
<>
<Bar/>
<Baz/>
{data}
</&g...
Cohby asked 2/11, 2019 at 18:2
2
is there a way that ApolloClient accepts request from servers with self signed certificates?
import ApolloClient from 'apollo-boost';
const client = new ApolloClient({
uri: `https://${window.l...
Cumulation asked 11/4, 2018 at 20:5
2
Solved
I'm currently trying to test a styled component with a Mocked Provider as follows:
import React from "react";
import TestResults from "./TestResults";
import {
render,
cleanup,
findByTestId,
...
Judaica asked 9/6, 2020 at 20:12
1
Using the following graphql:
scalar Date
type MyModel {
id: ID!
date: Date!
}
query MyModels {
myModels {
id
date
}
}
type Query {
myModel: [MyModel!]
}
and resolvers:
import { DateTimeR...
Kookaburra asked 7/2, 2021 at 8:25
1
Solved
Is it possible to configure the Apollo Client to fetch a single cached Item from a query that returns a list of Items, in order to prefetch data when querying for a single Item?
Schema:
type Item {...
Sargassum asked 22/1, 2021 at 9:35
1
I'm having a tough time getting my head around dynamic routing based on variables. I'm able to get a list of items in a collection but not an individual item and its fields for an individual page w...
Ouse asked 20/1, 2021 at 23:17
1
Solved
I have 3 different components that use the same graphql query. This example would be GET_USERS query. This is used when looking for users to message in the messaging respective tab and also when in...
Estelleesten asked 11/1, 2021 at 5:27
1
Solved
I'm using ApolloClient 3 the GitHub GraphQL API to retrieve all releases from a repo.
This is what the query looks like:
query ($owner: String!, $name: String!, $first: Int, $after: String, $before...
Sexed asked 3/12, 2020 at 14:5
1
Solved
I am developing a React form that's tied to a GraphQL mutation using the useMutation of Apollo Client. On the server, I perform some validation and in case of errors, I reject the mutation. On the ...
Titanate asked 26/12, 2020 at 14:44
2
Solved
Could someone provide an example of pagination implemented with Apollo Client 3.0 Field Policies. I've been following the example from the docs to implement infinite scroll but in my console I'm ge...
Hokum asked 5/7, 2020 at 15:1
4
Solved
I'm trying to reset the store after logout in my react-apollo application.
So I've created a method called "logout" which is called when I click on a button (and passed by the 'onDisconnect' props...
Crispas asked 20/2, 2018 at 14:27
5
I'm using Apollo Client's <Query> within a component that is re-rendered when state is changed within a lifecycle method. I wish to have my <Query> component re-run the query because I ...
Dodgem asked 26/7, 2018 at 3:18
2
Solved
I have a frontend with React and Apollo Client and am trying to write some simple tests.
My app looks like this:
ApolloProvider.js
import React from "react"
import App from "./App&qu...
Seventeenth asked 15/7, 2020 at 16:6
0
I am working on a single page webapp using React and Apollo Client, and I am wondering about how to correctly communicate authentication state between Apollo Client links and React context.
Within ...
Almeta asked 17/11, 2020 at 12:16
0
I need to do some memory usage profiling for a react native app using Apollo Client. Is there an easy way to determine how big the cache has grown at a certain point in time (API call or any other ...
Landy asked 12/11, 2020 at 12:24
1
Using Apollo Client 3 and eed to remove all the results of a query regardless of the arguments. Tried like this;
cache.evict({
id: "ROOT_QUERY",
fieldName: "countries"
});
...
Klimt asked 31/10, 2020 at 10:11
3
Solved
I need to make a cart for an online shop using reactjs and apollo-client.
How can I persist data using apollo-client with localStorage?
Jacinthe asked 6/12, 2019 at 10:49
3
Solved
I have a problem in my meteor/react/apollo (with boost) project. When I query data from the server, it adds __typename to every object and subobject in my query but it my case it creates a major is...
Advocate asked 18/10, 2018 at 12:12
2
Solved
I want to add a Context Link to an existing client's Apollo Link chain.
Here are two GitHub issues I've read through: First, Second.
I do not want to use local storage to store the token as the d...
Lightness asked 1/4, 2020 at 15:20
2
I want to use apollo to do some batch updates. And I need to start the batch script from node.
eg node myscript.js
I can't figure out how to do this. Is there a simple example that does what is de...
Astrionics asked 19/10, 2020 at 13:34
1
Using apollo client 3. Queried all countries and want to remove one country from cache and re-render UI.
Codesandbox
Tried like below;
onClick={() => {
cache.evict({ id: `Country:${country.code...
Chopin asked 18/10, 2020 at 15:59
0
I have a ts interface (for an apollo-client@v2 gql query) that has a __typename property. In the existing codebase there is a lot of "rehydration" of data object that re-adds the __typena...
Complainant asked 16/10, 2020 at 9:54
3
I have a filtered list of items based on a getAllItems query, which takes a filter and an order by option as arguments.
After creating a new item, I want to delete the cache for this query, no mat...
Clandestine asked 3/2, 2018 at 10:21
2
Another post shared an example of how to unsubscribe, where the Apollo docs don't. The Apollo docs do mention what subscribeToMore returns...
subscribeToMore: A function that sets up a subscript...
Inward asked 3/3, 2020 at 21:2
© 2022 - 2024 — McMap. All rights reserved.