apollo-client: [2.0] old data after mutation | bug
Hi, I have next query
query getMini($id: ID!) {
mini(id: $id) {
id
cover(maxWidth: 600, maxHeight: 400)
}
}
and next mutation
mutation ($signature: String!) {
mini: submitMiniCoverS3DirectUpload(signature: $signature) {
id
cover(maxWidth: 600, maxHeight: 400)
}
}
as you can see after success mutation I will get new cover photo. So far so good. Everything is working fine with apolo 1.x. In apollo 2 I will get same cached cover photo after mutation. I checked response from server. There are valid new fields. But apollo is using old cached data.
I am using latest versions of all libraries:
"apollo-cache-inmemory": "^0.2.0-rc.1",
"apollo-client": "^2.0.0-rc.3",
"apollo-link": "^0.8.0",
"apollo-link-http": "^0.8.0",
"apollo-link-batch-http": "^0.4.0",
"apollo-link-retry": "^0.8.0",
"apollo-link-dedup": "^0.6.0",
I think that this is related also to last comment https://github.com/apollographql/apollo-client/issues/2266#issuecomment-335933377.
FYI: fetchPolicy: ‘network-only’ is not working
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 25 (18 by maintainers)
I think that this is related to https://github.com/apollographql/react-apollo/issues/1257#issuecomment-338184744 as well.
So, I got 2 queries and 1 mutation:
When I update an existing item (inside a modal that closes after save, so unmounting), I’m getting the new values returned from the mutation and the list immediately updates accordingly (so far everything good). But when I reopen the item/modal, it has the old values. As soon as the list polling interval kicks in, the modal immediately shows the correct values.
fixed by rc7