Home > database >  Encountered a sub-selection on the query, but the store doesn't have an object reference. angul
Encountered a sub-selection on the query, but the store doesn't have an object reference. angul

Time:05-09

I'm getting this error when I try to make some gql query:

enter image description here

I have tried to change the angular version, but I need to implement gql in this version. without upgrading :/

package.json

{
  "dependencies": {
    "@angular/cdk": "^5.2.5",
    "@angular/common": "^5.2.10",
    "@angular/compiler": "^5.2.10",
    "@angular/core": "^5.2.10",
    ...
    "rxjs": "^5.5.9",
    "zone.js": "^0.8.26",
    "apollo-angular": "^1.0.1",
    "apollo-angular-link-http": "^1.0.2-beta.0",
    "apollo-cache-inmemory": "^1.1.5",
    "apollo-client": "^2.2.0",
    "graphql": "^0.12.3",
    "graphql-tag": "^2.6.1"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.4",
    "@angular/compiler-cli": "^5.2.10",
    "@types/node": "^9.6.6",
    "ts-node": "^4.1.0",
    "tslint": "^5.9.1",
    "typescript": "^2.8.3"
  }
}

app.module.ts

...
import { ApolloModule, Apollo } from 'apollo-angular';
import { HttpLinkModule, HttpLink  } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';

@NgModule({
  imports: [
    ...
    HttpClientModule,
    ApolloModule,
    HttpLinkModule
  ],
..
})
export class AppModule {

  constructor(
    apollo: Apollo,
    httpLink: HttpLink
  ) {
    apollo.create({
      link: httpLink.create({ uri: 'https://graphqlzero.almansi.me/api'}),
      cache: new InMemoryCache()
    });
  }
}

How can I solve this?

CodePudding user response:

I solved this by upgrading apollo-cache-inmemory from 1.1.5 to 1.3.0

  • Related