Questions tagged [apollo-link-state]

24 questions
0
votes
1 answer

Return value from mutation is empty and/or undefined

When running an @client mutation using apollo-link-state, then response from the resolver is merely: { data: {}, errors: undefined } From the resolver i'm returning {data: { ...product }}. Where the product is an object with multiple values,…
Mcbeer
  • 88
  • 10
0
votes
2 answers

Apollo Client: Keep/Reset defaults on clearing or resetting store

I'm using apollo-link-state for locally storing errors, but I get the following error after clearing cache. I've set the default value of errors to an empty array [] in apollo client configuration options. However, after apolloClient.cache.reset()…
nomadoda
  • 4,561
  • 3
  • 30
  • 45
0
votes
1 answer

Graphql query fails for deep local state in Apollo

I'm creating an apollo react application. I want apollo to manage my local state. I want to structure my local state so not all scalar values are at the top level. This is my configuration: import React from 'react' import ReactDOM from…
0
votes
1 answer

apollo-link-state using nested objects as default

I tried to use below object as default in apollo-link-state apolloClientDemo: { __typename: 'ApolloClientDemo', currentPageName: 'Apollo Demo Default...', pages: ["page1", "page2"], pageObj:{ color:"red", …
killjoy
  • 864
  • 17
  • 31
0
votes
1 answer

Passing Apollo Client cache data with apollo Query

I have two queries: const GET_FILTERS = gql` query getFilters { filters @client { id title selected } } ` And const GET_POSTS = gql` query getPosts { posts { id author status } } ` First…
Kocur4d
  • 6,701
  • 8
  • 35
  • 53
0
votes
0 answers

What is the purpose of defaults in Apollo Link State?

Why would one do this: const clientState = { defaults: { networkStatus: { __typename: 'NetworkStatus', id: 1, isConnected: false, }, }, resolvers: {}, }; Over this: const clientState = { resolvers: { Query: { …
0
votes
1 answer

React-Native + Apollo-Link-State + AWS Appsync : Defaults are not stored in cache

I'm struggling with this for days. I've successfully configure Apollo-Link-State with AppSync a month ago and start adding defaults and resolvers like this : const cache = new InMemoryCache() //create the cache to be shared by appsync and…
0
votes
1 answer

Apollo link state vs built-in React state

I was thinking if I should use React built-in state state = {} when using apollo link state. Should I keep everything what is my local state in the apollo link state? Let me give you an example: I have a component which has a…
matiash
  • 53
  • 4
0
votes
1 answer

cache.readQuery using @client raises: Cannot read property 'kind' of undefined

I've created very simple "login" page that is supposed to store 'email' and 'password' in local cache and then, onSubmit, to display stored values on console (this is done with mutation in resolvers.js). Saving email and password values to the cache…
1
2