apollo-client: Cannot set property 'networkStatus' of undefined error occurs when fetchMore gets called
Intended outcome:
I’m trying to use fetchMore function that is described at your documentation. link : https://www.apollographql.com/docs/angular/recipes/pagination.html#fetch-more
below is the actual code :
this.fetchQuery = this.apollo.watchQuery<any>({
query: gql`
query FetchTrainingData ($projectId: String!, $label: String, $page: Int, $size:Int, $order: OrderType){
trainingData(projectId: $projectId, label: $label, page: $page, size:$size, order: $order) {
sentence
labels
id
updateCount
}
}
`,
variables: {
projectId: "",
page: null,
label: null,
order: null,
size: null
}
});
this.fetchQuery.fetchMore({
variables: {
projectId: this.projectId,
label: null,
page: page,
size: size,
order: null
},
updateQuery: (prev, { fetchMoreResult }) => {
if (!fetchMoreResult) { return prev; }
return Object.assign({}, prev, {
feed: [...prev.feed, ...fetchMoreResult.feed],
});
},
}).then(res => {
console.log(res);
})
but when fetchMore gets invoked, “Cannot set property ‘networkStatus’ of undefined” error occurs.
ps. After the 2.0.0 releases your documentations are very unstable .Inside the example code about usage of fetchMore(above link) there is no such “this.feedObs” property. Maybe you guys meant “this.feedQuery”. And also the “forceFetch” property inside watchquery options does not exist in type WatchQueryOptions & TypedVariables<V>.
Actual outcome:


How to reproduce the issue:
Version
"apollo-angular": "1.0.0-beta.2",
"apollo-angular-link-http": "1.0.0-beta.5",
"apollo-cache-inmemory": "1.1.0",
"apollo-client": "^2.0.2",
"apollo-link-context": "1.0.0"
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 18 (4 by maintainers)
@sondremare is right, it’s the same issue. When you first send a request & that request fails, a normal network error is thrown, but then when you send the fetchMore request the Cannot set property ‘networkStatus’ of undefined error occurs.
hey guys, @seanyu4296 @DeviousM @pycraft114, this worked for me. you’ll need both steps.
@alewiahmed - thanks for the tip, but unfortunately I can’t edit built library as our CI is downloading it on it’s own (therefore there’s no feasible way to do it properly this way). But there’s a hope though, that it will be done 😄