在查询中遇到子选择,但商店没有对象引用。 angular

Encountered a sub-selection on the query, but the store doesn't have an object reference. angular

我尝试进行一些 gql 查询时遇到此错误:

我已经尝试更改angular版本,但我需要在这个版本中实现gql。没有升级:/

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()
    });
  }
}

我该如何解决这个问题?

我通过将 apollo-cache-inmemory1.1.5 升级到 1.3.0

解决了这个问题