Closed andreialecu closed 3 years ago
Nevermind, the problem was that this project had configured no-cache
as the default cache policy:
const defaultOptions = {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'ignore',
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all',
},
};
Describe the bug
This is a pretty weird one. We have a query that we're using
.watch()
on.The APIs are generated by
graphql-code-generator
We've been troubleshooting a mutation not updating a watched query. After randomly trying things, it appears that what fixed it was setting an explicit
fetchPolicy
.Even using the default
fetchPolicy
seems to work, as long as something is specified. It cannot beundefined
.To Reproduce Steps to reproduce the behavior:
appClubPermissions
Expected behavior
fetchPolicy
should be optional, and the query should update by default.Environment:
@apollo/client
: 3.3.12apollo-angular
: 2.4.0graphql
: 15.5.0@angular/core
: 11.2.5@angular/cli
: 11.2.5typescript
: 4.1.0Additional context
Not sure if relevant, but the type itself defines custom
keyFields
in thecache
, like: