Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encountered a sub-selection on the query, but the store doesn't have an object reference Apollo Link State

This is my main query to get all data from a server.

Query to get data from server

Then I would like to set this in Apollo link state.

To set in link state here's my resolver.

resolver for link state

This is my client/cache query to get previous cache state.

local client/cache query

I don't know where I'm missing anything on this.

ApolloError.js:37 Uncaught (in promise) Error: Network error: Encountered a sub-selection on the query, but the store doesn't have an object reference. This should never happen during normal use unless you have custom code that is directly manipulating the store; please file an issue.

like image 515
Tanuj Upreti Avatar asked Oct 08 '18 16:10

Tanuj Upreti


1 Answers

This error might be happening due to apollo-cache-inmemory package version. Try updating the package to the latest version:

npm update apollo-cache-inmemory

This github thread is trying to track the issue and updating the package seems to work just fine: https://github.com/apollographql/apollo-client/issues/4125

like image 187
alexandressh Avatar answered Nov 13 '22 00:11

alexandressh