Cannot set property 'networkStatus' of undefined error occurs when fetchMore gets called
See original GitHub issueIntended 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"
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:18 (4 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'fetchMore' of undefined in ...
I believe the issue is that you are using fetchMore within useEffect hook. Try to rethink your code to avoid this. Using fetchMore...
Read more >Fetching data with queries | Full-Stack Quickstart
We need Apollo Client to instead merge the launches from our fetchMore query with the launches from our original query. Let's configure that...
Read more >Query and store data - New Relic Developers
Set to undefined when data is loading or the fetch was successful. fetchMore : Callback function that can be called when the query...
Read more >React TypeError: Cannot read property function of undefined
SET YOUR LIKE THERE ... Your browser can't play this video. ... Solved: React TypeError: Cannot read property function of undefined.
Read more >Smart Query | Vue Apollo
to customize the value that is set in the vue property, ... options) is a hook called when there are errors. error is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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.