Closed
Description
Hi.
First problem
If I define a query in my component like this:
export default {
// ...
apollo: {
users: {
query: myQuery,
update: (data) => data.users.getAll,
loadingKey: 'loading',
watchLoading(loading, modifier) { console.log(loading, modifier) },
variables () { return this.emailFilter }
}
}
// ...
}
The code above works fine.
this.apollo.queris.users.fetchMore({
// ... variable here for pagination "limit" (page size) and "after" (cursor)
updateQuery: (previousResult, { fetchMoreResult }) => {
return {
user: {
getAll: [
...previousResult.user.getAll,
...fetchMoreResult.user.getAll,
],
__typename: previousResult.__typename
}
}
})
This works fine. But if I have to set __typename
manually or I get a warning about it missing.
Is this normal ?
Second, actual problem
In updateQuery
if fetchMoreResult.user.getAll
is an empty array (when the pagination is over), the loadingKey
is never decreased and watchLoading
doesn't print false, -1
.
Steps to reproduce :
- Call fetchMore: new users received : everything is fine, the loading key is increased then decreased
- Repeat step one several time : as long as some users are returned, everything is fine
- Call fetchMore: no new users received (empty array from graph). The loading key was correctly increased but never decreased.
Metadata
Metadata
Assignees
Labels
No labels