{"action":"created","comment":{"url":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments/71243309","id":71243309,"diff_hunk":"@@ -575,6 +584,56 @@ export class QueryManager {\n     });\n   }\n \n+  private collectResultBehaviorsFromReducers(updateQueries, mutationResult, isOptimistic = false) {\n+    if (!updateQueries) {\n+      return [];\n+    }\n+    const additionalResultBehaviors = [];\n+\n+    const observableQueriesByName: { [name: string]: ObservableQuery[] } = {};\n+    Object.keys(this.observableQueries).forEach((key) => {\n+      const observableQuery = this.observableQueries[key].observableQuery;\n+      const queryName = getQueryDefinition(observableQuery.options.query).name.value;\n+\n+      observableQueriesByName[queryName] =\n+        observableQueriesByName[queryName] || [];\n+      observableQueriesByName[queryName].push(observableQuery);\n+    });\n+\n+    Object.keys(updateQueries).forEach((queryName) => {\n+      const reducer = updateQueries[queryName];\n+      const queries = observableQueriesByName[queryName];\n+      if (!queries) {\n+        // XXX should throw an error?\n+        return;\n+      }\n+\n+      queries.forEach((observableQuery) => {\n+        const queryOptions = observableQuery.options;\n+        const queryDefinition: OperationDefinition = getQueryDefinition(queryOptions.query);\n+        const previousResult = readSelectionSetFromStore({\n+          store: isOptimistic ? this.getDataWithOptimisticResults() : this.getApolloState().data,","path":"src/QueryManager.ts","position":115,"original_position":115,"commit_id":"77551cff1cf61b3d159489abda0ca7765bb86018","original_commit_id":"77551cff1cf61b3d159489abda0ca7765bb86018","user":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"body":"I'd add a comment about why we have this conditional - it's because we want to apply new optimistic results on top of old optimistic results, but real results on top of real data only.","created_at":"2016-07-18T22:32:46Z","updated_at":"2016-07-18T22:32:46Z","html_url":"https://github.com/apollostack/apollo-client/pull/404#discussion_r71243309","pull_request_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/404","_links":{"self":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments/71243309"},"html":{"href":"https://github.com/apollostack/apollo-client/pull/404#discussion_r71243309"},"pull_request":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/404"}}},"pull_request":{"url":"https://api.github.com/repos/apollostack/apollo-client/pulls/404","id":77546883,"html_url":"https://github.com/apollostack/apollo-client/pull/404","diff_url":"https://github.com/apollostack/apollo-client/pull/404.diff","patch_url":"https://github.com/apollostack/apollo-client/pull/404.patch","issue_url":"https://api.github.com/repos/apollostack/apollo-client/issues/404","number":404,"state":"open","locked":false,"title":"Mutation reducers","user":{"login":"Slava","id":2608446,"avatar_url":"https://avatars.githubusercontent.com/u/2608446?v=3","gravatar_id":"","url":"https://api.github.com/users/Slava","html_url":"https://github.com/Slava","followers_url":"https://api.github.com/users/Slava/followers","following_url":"https://api.github.com/users/Slava/following{/other_user}","gists_url":"https://api.github.com/users/Slava/gists{/gist_id}","starred_url":"https://api.github.com/users/Slava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Slava/subscriptions","organizations_url":"https://api.github.com/users/Slava/orgs","repos_url":"https://api.github.com/users/Slava/repos","events_url":"https://api.github.com/users/Slava/events{/privacy}","received_events_url":"https://api.github.com/users/Slava/received_events","type":"User","site_admin":false},"body":"- [x] Update CHANGELOG.md with your change\r\n- [x] Make sure all of the significant new logic is covered by tests\r\n- [x] Rebase your changes on master so that they can be merged easily\r\n- [x] Make sure all tests and linter rules pass\r\n","created_at":"2016-07-15T00:20:51Z","updated_at":"2016-07-18T22:32:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1d0369845be5dfee8da731087a397bc31245a9f","assignee":{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false},"assignees":[{"login":"stubailo","id":448783,"avatar_url":"https://avatars.githubusercontent.com/u/448783?v=3","gravatar_id":"","url":"https://api.github.com/users/stubailo","html_url":"https://github.com/stubailo","followers_url":"https://api.github.com/users/stubailo/followers","following_url":"https://api.github.com/users/stubailo/following{/other_user}","gists_url":"https://api.github.com/users/stubailo/gists{/gist_id}","starred_url":"https://api.github.com/users/stubailo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stubailo/subscriptions","organizations_url":"https://api.github.com/users/stubailo/orgs","repos_url":"https://api.github.com/users/stubailo/repos","events_url":"https://api.github.com/users/stubailo/events{/privacy}","received_events_url":"https://api.github.com/users/stubailo/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/404/commits","review_comments_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/404/comments","review_comment_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apollostack/apollo-client/issues/404/comments","statuses_url":"https://api.github.com/repos/apollostack/apollo-client/statuses/77551cff1cf61b3d159489abda0ca7765bb86018","head":{"label":"apollostack:mutation-reducers","ref":"mutation-reducers","sha":"77551cff1cf61b3d159489abda0ca7765bb86018","user":{"login":"apollostack","id":17189275,"avatar_url":"https://avatars.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollostack","html_url":"https://github.com/apollostack","followers_url":"https://api.github.com/users/apollostack/followers","following_url":"https://api.github.com/users/apollostack/following{/other_user}","gists_url":"https://api.github.com/users/apollostack/gists{/gist_id}","starred_url":"https://api.github.com/users/apollostack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollostack/subscriptions","organizations_url":"https://api.github.com/users/apollostack/orgs","repos_url":"https://api.github.com/users/apollostack/repos","events_url":"https://api.github.com/users/apollostack/events{/privacy}","received_events_url":"https://api.github.com/users/apollostack/received_events","type":"Organization","site_admin":false},"repo":{"id":52630616,"name":"apollo-client","full_name":"apollostack/apollo-client","owner":{"login":"apollostack","id":17189275,"avatar_url":"https://avatars.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollostack","html_url":"https://github.com/apollostack","followers_url":"https://api.github.com/users/apollostack/followers","following_url":"https://api.github.com/users/apollostack/following{/other_user}","gists_url":"https://api.github.com/users/apollostack/gists{/gist_id}","starred_url":"https://api.github.com/users/apollostack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollostack/subscriptions","organizations_url":"https://api.github.com/users/apollostack/orgs","repos_url":"https://api.github.com/users/apollostack/repos","events_url":"https://api.github.com/users/apollostack/events{/privacy}","received_events_url":"https://api.github.com/users/apollostack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apollostack/apollo-client","description":":rocket: A simple caching client for any GraphQL server and UI framework","fork":false,"url":"https://api.github.com/repos/apollostack/apollo-client","forks_url":"https://api.github.com/repos/apollostack/apollo-client/forks","keys_url":"https://api.github.com/repos/apollostack/apollo-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apollostack/apollo-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apollostack/apollo-client/teams","hooks_url":"https://api.github.com/repos/apollostack/apollo-client/hooks","issue_events_url":"https://api.github.com/repos/apollostack/apollo-client/issues/events{/number}","events_url":"https://api.github.com/repos/apollostack/apollo-client/events","assignees_url":"https://api.github.com/repos/apollostack/apollo-client/assignees{/user}","branches_url":"https://api.github.com/repos/apollostack/apollo-client/branches{/branch}","tags_url":"https://api.github.com/repos/apollostack/apollo-client/tags","blobs_url":"https://api.github.com/repos/apollostack/apollo-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apollostack/apollo-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apollostack/apollo-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/apollostack/apollo-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apollostack/apollo-client/statuses/{sha}","languages_url":"https://api.github.com/repos/apollostack/apollo-client/languages","stargazers_url":"https://api.github.com/repos/apollostack/apollo-client/stargazers","contributors_url":"https://api.github.com/repos/apollostack/apollo-client/contributors","subscribers_url":"https://api.github.com/repos/apollostack/apollo-client/subscribers","subscription_url":"https://api.github.com/repos/apollostack/apollo-client/subscription","commits_url":"https://api.github.com/repos/apollostack/apollo-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/apollostack/apollo-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/apollostack/apollo-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/apollostack/apollo-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/apollostack/apollo-client/contents/{+path}","compare_url":"https://api.github.com/repos/apollostack/apollo-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apollostack/apollo-client/merges","archive_url":"https://api.github.com/repos/apollostack/apollo-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apollostack/apollo-client/downloads","issues_url":"https://api.github.com/repos/apollostack/apollo-client/issues{/number}","pulls_url":"https://api.github.com/repos/apollostack/apollo-client/pulls{/number}","milestones_url":"https://api.github.com/repos/apollostack/apollo-client/milestones{/number}","notifications_url":"https://api.github.com/repos/apollostack/apollo-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apollostack/apollo-client/labels{/name}","releases_url":"https://api.github.com/repos/apollostack/apollo-client/releases{/id}","deployments_url":"https://api.github.com/repos/apollostack/apollo-client/deployments","created_at":"2016-02-26T20:25:00Z","updated_at":"2016-07-18T13:56:04Z","pushed_at":"2016-07-18T22:15:29Z","git_url":"git://github.com/apollostack/apollo-client.git","ssh_url":"git@github.com:apollostack/apollo-client.git","clone_url":"https://github.com/apollostack/apollo-client.git","svn_url":"https://github.com/apollostack/apollo-client","homepage":"http://docs.apollostack.com/apollo-client/","size":1597,"stargazers_count":642,"watchers_count":642,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"open_issues_count":76,"forks":49,"open_issues":76,"watchers":642,"default_branch":"master"}},"base":{"label":"apollostack:master","ref":"master","sha":"dbc2d92dd89367b50ac5ab2a189aaf10325a1fb2","user":{"login":"apollostack","id":17189275,"avatar_url":"https://avatars.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollostack","html_url":"https://github.com/apollostack","followers_url":"https://api.github.com/users/apollostack/followers","following_url":"https://api.github.com/users/apollostack/following{/other_user}","gists_url":"https://api.github.com/users/apollostack/gists{/gist_id}","starred_url":"https://api.github.com/users/apollostack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollostack/subscriptions","organizations_url":"https://api.github.com/users/apollostack/orgs","repos_url":"https://api.github.com/users/apollostack/repos","events_url":"https://api.github.com/users/apollostack/events{/privacy}","received_events_url":"https://api.github.com/users/apollostack/received_events","type":"Organization","site_admin":false},"repo":{"id":52630616,"name":"apollo-client","full_name":"apollostack/apollo-client","owner":{"login":"apollostack","id":17189275,"avatar_url":"https://avatars.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollostack","html_url":"https://github.com/apollostack","followers_url":"https://api.github.com/users/apollostack/followers","following_url":"https://api.github.com/users/apollostack/following{/other_user}","gists_url":"https://api.github.com/users/apollostack/gists{/gist_id}","starred_url":"https://api.github.com/users/apollostack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollostack/subscriptions","organizations_url":"https://api.github.com/users/apollostack/orgs","repos_url":"https://api.github.com/users/apollostack/repos","events_url":"https://api.github.com/users/apollostack/events{/privacy}","received_events_url":"https://api.github.com/users/apollostack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apollostack/apollo-client","description":":rocket: A simple caching client for any GraphQL server and UI framework","fork":false,"url":"https://api.github.com/repos/apollostack/apollo-client","forks_url":"https://api.github.com/repos/apollostack/apollo-client/forks","keys_url":"https://api.github.com/repos/apollostack/apollo-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apollostack/apollo-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apollostack/apollo-client/teams","hooks_url":"https://api.github.com/repos/apollostack/apollo-client/hooks","issue_events_url":"https://api.github.com/repos/apollostack/apollo-client/issues/events{/number}","events_url":"https://api.github.com/repos/apollostack/apollo-client/events","assignees_url":"https://api.github.com/repos/apollostack/apollo-client/assignees{/user}","branches_url":"https://api.github.com/repos/apollostack/apollo-client/branches{/branch}","tags_url":"https://api.github.com/repos/apollostack/apollo-client/tags","blobs_url":"https://api.github.com/repos/apollostack/apollo-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apollostack/apollo-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apollostack/apollo-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/apollostack/apollo-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apollostack/apollo-client/statuses/{sha}","languages_url":"https://api.github.com/repos/apollostack/apollo-client/languages","stargazers_url":"https://api.github.com/repos/apollostack/apollo-client/stargazers","contributors_url":"https://api.github.com/repos/apollostack/apollo-client/contributors","subscribers_url":"https://api.github.com/repos/apollostack/apollo-client/subscribers","subscription_url":"https://api.github.com/repos/apollostack/apollo-client/subscription","commits_url":"https://api.github.com/repos/apollostack/apollo-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/apollostack/apollo-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/apollostack/apollo-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/apollostack/apollo-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/apollostack/apollo-client/contents/{+path}","compare_url":"https://api.github.com/repos/apollostack/apollo-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apollostack/apollo-client/merges","archive_url":"https://api.github.com/repos/apollostack/apollo-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apollostack/apollo-client/downloads","issues_url":"https://api.github.com/repos/apollostack/apollo-client/issues{/number}","pulls_url":"https://api.github.com/repos/apollostack/apollo-client/pulls{/number}","milestones_url":"https://api.github.com/repos/apollostack/apollo-client/milestones{/number}","notifications_url":"https://api.github.com/repos/apollostack/apollo-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apollostack/apollo-client/labels{/name}","releases_url":"https://api.github.com/repos/apollostack/apollo-client/releases{/id}","deployments_url":"https://api.github.com/repos/apollostack/apollo-client/deployments","created_at":"2016-02-26T20:25:00Z","updated_at":"2016-07-18T13:56:04Z","pushed_at":"2016-07-18T22:15:29Z","git_url":"git://github.com/apollostack/apollo-client.git","ssh_url":"git@github.com:apollostack/apollo-client.git","clone_url":"https://github.com/apollostack/apollo-client.git","svn_url":"https://github.com/apollostack/apollo-client","homepage":"http://docs.apollostack.com/apollo-client/","size":1597,"stargazers_count":642,"watchers_count":642,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"open_issues_count":76,"forks":49,"open_issues":76,"watchers":642,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/404"},"html":{"href":"https://github.com/apollostack/apollo-client/pull/404"},"issue":{"href":"https://api.github.com/repos/apollostack/apollo-client/issues/404"},"comments":{"href":"https://api.github.com/repos/apollostack/apollo-client/issues/404/comments"},"review_comments":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/404/comments"},"review_comment":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/404/commits"},"statuses":{"href":"https://api.github.com/repos/apollostack/apollo-client/statuses/77551cff1cf61b3d159489abda0ca7765bb86018"}}}}
{"actor":{"display_login":"stubailo"}}