{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/2177","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2177/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2177/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2177/events","html_url":"https://github.com/apollographql/react-apollo/issues/2177","id":340593192,"node_id":"MDU6SXNzdWUzNDA1OTMxOTI=","number":2177,"title":"Query.onCompleted isn't fired after fetching data from the cache","user":{"login":"elessarperm","id":2877264,"node_id":"MDQ6VXNlcjI4NzcyNjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2877264?v=4","gravatar_id":"","url":"https://api.github.com/users/elessarperm","html_url":"https://github.com/elessarperm","followers_url":"https://api.github.com/users/elessarperm/followers","following_url":"https://api.github.com/users/elessarperm/following{/other_user}","gists_url":"https://api.github.com/users/elessarperm/gists{/gist_id}","starred_url":"https://api.github.com/users/elessarperm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elessarperm/subscriptions","organizations_url":"https://api.github.com/users/elessarperm/orgs","repos_url":"https://api.github.com/users/elessarperm/repos","events_url":"https://api.github.com/users/elessarperm/events{/privacy}","received_events_url":"https://api.github.com/users/elessarperm/received_events","type":"User","site_admin":false},"labels":[{"id":357770007,"node_id":"MDU6TGFiZWwzNTc3NzAwMDc=","url":"https://api.github.com/repos/apollographql/react-apollo/labels/bug","name":"bug","color":"b60205","default":true},{"id":578501826,"node_id":"MDU6TGFiZWw1Nzg1MDE4MjY=","url":"https://api.github.com/repos/apollographql/react-apollo/labels/confirmed","name":"confirmed","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":{"login":"hwillson","id":137740,"node_id":"MDQ6VXNlcjEzNzc0MA==","avatar_url":"https://avatars1.githubusercontent.com/u/137740?v=4","gravatar_id":"","url":"https://api.github.com/users/hwillson","html_url":"https://github.com/hwillson","followers_url":"https://api.github.com/users/hwillson/followers","following_url":"https://api.github.com/users/hwillson/following{/other_user}","gists_url":"https://api.github.com/users/hwillson/gists{/gist_id}","starred_url":"https://api.github.com/users/hwillson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwillson/subscriptions","organizations_url":"https://api.github.com/users/hwillson/orgs","repos_url":"https://api.github.com/users/hwillson/repos","events_url":"https://api.github.com/users/hwillson/events{/privacy}","received_events_url":"https://api.github.com/users/hwillson/received_events","type":"User","site_admin":false},"assignees":[{"login":"hwillson","id":137740,"node_id":"MDQ6VXNlcjEzNzc0MA==","avatar_url":"https://avatars1.githubusercontent.com/u/137740?v=4","gravatar_id":"","url":"https://api.github.com/users/hwillson","html_url":"https://github.com/hwillson","followers_url":"https://api.github.com/users/hwillson/followers","following_url":"https://api.github.com/users/hwillson/following{/other_user}","gists_url":"https://api.github.com/users/hwillson/gists{/gist_id}","starred_url":"https://api.github.com/users/hwillson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwillson/subscriptions","organizations_url":"https://api.github.com/users/hwillson/orgs","repos_url":"https://api.github.com/users/hwillson/repos","events_url":"https://api.github.com/users/hwillson/events{/privacy}","received_events_url":"https://api.github.com/users/hwillson/received_events","type":"User","site_admin":false}],"milestone":null,"comments":29,"created_at":"2018-07-12T11:11:34Z","updated_at":"2018-12-04T07:55:51Z","closed_at":"2018-09-21T16:23:30Z","author_association":"NONE","body":"**Intended outcome:**\r\nI tried to make a side-effect when query result is fetched using `<Query onCompleted={...}>`\r\n\r\n**Actual outcome:**\r\n`onCompleted` fired after the real network request, but when I changed variables and then switched them back, query result was returned from the cache and `onCompleted` handler wasn't executed.\r\nHowever, it works when I change `fetchPolicy` to `cache-and-network` or `network-only`.\r\n\r\n**How to reproduce the issue:**\r\nMake a `<Query>` that should log result into console when completed. Run it with some variables,\r\nthen change it to cause re-render, then return variables back to make it re-render result from cache.\r\n`onCompleted` handler won't be fired.\r\nfetchPolicy should be `cache-first`\r\n\r\n**Versions**\r\n  npmPackages:\r\n    apollo-boost: ^0.1.10 => 0.1.10\r\n    apollo-cache-inmemory: ^1.2.5 => 1.2.5\r\n    apollo-client: ^2.3.5 => 2.3.5\r\n    apollo-link: ^1.2.2 => 1.2.2\r\n    apollo-link-http: ^1.5.4 => 1.5.4\r\n    react-apollo: ^2.1.9 => 2.1.9\r\n\r\n\r\nIf it's not a bug, but a feature, can you explain how could I perform a side-effect after every query completion regardless of it uses cache or not?"},"comment":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/comments/444005038","html_url":"https://github.com/apollographql/react-apollo/issues/2177#issuecomment-444005038","issue_url":"https://api.github.com/repos/apollographql/react-apollo/issues/2177","id":444005038,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDAwNTAzOA==","user":{"login":"kandros","id":4562878,"node_id":"MDQ6VXNlcjQ1NjI4Nzg=","avatar_url":"https://avatars0.githubusercontent.com/u/4562878?v=4","gravatar_id":"","url":"https://api.github.com/users/kandros","html_url":"https://github.com/kandros","followers_url":"https://api.github.com/users/kandros/followers","following_url":"https://api.github.com/users/kandros/following{/other_user}","gists_url":"https://api.github.com/users/kandros/gists{/gist_id}","starred_url":"https://api.github.com/users/kandros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kandros/subscriptions","organizations_url":"https://api.github.com/users/kandros/orgs","repos_url":"https://api.github.com/users/kandros/repos","events_url":"https://api.github.com/users/kandros/events{/privacy}","received_events_url":"https://api.github.com/users/kandros/received_events","type":"User","site_admin":false},"created_at":"2018-12-04T07:55:51Z","updated_at":"2018-12-04T07:55:51Z","author_association":"CONTRIBUTOR","body":"@ridhoq there are a couple of bugs in fetchPolicy that have unexpected behaviours when mixed with other props"}}
{"actor":{"display_login":"kandros"}}