Hey :wave: I’m going through the `<http://howtogr...
# prisma-whats-new
k
Hey 👋 I’m going through the
<http://howtographql.com/react-apollo|howtographql.com/react-apollo>
tutorial and I got blocked by an error at the
More mutations and updating the store state
section. Can someone help me with this?
Copy code
_updateCacheAfterVote = (store, createVote, linkId) => {
  // 1
  const data = store.readQuery({ query: FEED_QUERY })

  // 2
  const votedLink = data.feed.links.find(link => link.id === linkId)
  votedLink.votes = createVote.link.votes

  // 3
  store.writeQuery({ query: FEED_QUERY, data })
}
at
store.readQuery({ query: FEED_QUERY })
i get the following error:
Copy code
index.js:2178 Error: Can't find field feed({"first":100,"skip":0,"orderBy":null}) on object (ROOT_QUERY) {
  "feed({\"first\":null,\"skip\":null,\"orderBy\":null})": {
    "type": "id",
    "id": "$ROOT_QUERY.feed({\"first\":null,\"skip\":null,\"orderBy\":null})",
    "generated": true
  }
}.
    at readStoreResolver (readFromStore.js:39)
    at executeField (graphql.js:70)
    at graphql.js:27
    at Array.forEach (anonymous)
    at executeSelectionSet (graphql.js:22)
    at graphql (graphql.js:17)
    at diffQueryAgainstStore (readFromStore.js:71)
    at readQueryFromStore (readFromStore.js:14)
    at InMemoryCache../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.InMemoryCache.read (inMemoryCache.js:75)
    at InMemoryCache../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.InMemoryCache.readQuery (inMemoryCache.js:165)
    at Object.LinkList._this._updateCacheAfterVote [as updateStoreAfterVote] (LinkList.js:37)
    at update (Link.js:44)
    at store.js:113
    at tryFunctionOrLogError (errorHandling.js:3)
    at store.js:113
    at InMemoryCache../node_modules/apollo-cache-inmemory/lib/inMemoryCache.js.InMemoryCache.performTransaction (inMemoryCache.js:135)
    at DataStore../node_modules/apollo-client/data/store.js.DataStore.markMutationResult (store.js:112)
    at Object.next (QueryManager.js:95)
    at SubscriptionObserver.next (zen-observable.js:154)
    at httpLink.js:140
    at anonymous
I’ve been around the web to find a solution for this problem, but none of them helped me. 😞 Thanks in advance for your help!
q
hi, you need to remove your query arguments in FEED_QUERY
k
@QuCode i’ll try it out in a minute
q
I created a pull request (https://github.com/howtographql/howtographql/pull/428) to fix that, but it still needs to be merged @nikolasburk
👍 2
k
@QuCode thank you, it did the trick 🙏
👍 1
n
Just merged the PR, sorry for the delay and thanks so much for catching this @QuCode! 🙏
👍 2