{"action":"created","comment":{"url":"https://api.github.com/repos/apollographql/apollo-android/pulls/comments/125502771","pull_request_review_id":47897721,"id":125502771,"diff_hunk":"@@ -225,23 +225,63 @@ public RealApolloStore(@Nonnull NormalizedCache normalizedCache, @Nonnull CacheK\n     });\n   }\n \n-  @Override public <D extends Operation.Data, T, V extends Operation.Variables> void write(\n+  @Override @Nonnull public <D extends Operation.Data, T, V extends Operation.Variables> Set<String> write(\n       @Nonnull final Operation<D, T, V> operation, @Nonnull final D operationData) {\n     checkNotNull(operation, \"operation == null\");\n     checkNotNull(operationData, \"operationData == null\");\n-    writeTransaction(new Transaction<WriteableStore, Boolean>() {\n-      @Override public Boolean execute(WriteableStore cache) {\n-        CacheResponseWriter cacheResponseWriter = new CacheResponseWriter(operation, customTypeAdapters);\n+    return writeTransaction(new Transaction<WriteableStore, Set<String>>() {\n+      @Override public Set<String> execute(WriteableStore cache) {\n+        CacheResponseWriter cacheResponseWriter = new CacheResponseWriter(operation.variables(), customTypeAdapters);\n         try {\n           operationData.marshaller().marshal(cacheResponseWriter);\n-          Collection<Record> records = cacheResponseWriter.normalize(networkResponseNormalizer());\n-          merge(records, CacheHeaders.NONE);\n+          ResponseNormalizer<Map<String, Object>> responseNormalizer = networkResponseNormalizer();\n+          responseNormalizer.willResolveRootQuery(operation);\n+          Collection<Record> records = cacheResponseWriter.normalize(responseNormalizer);\n+          return merge(records, CacheHeaders.NONE);\n+        } catch (IOException e) {\n+          logger.e(e, \"Failed to write operation data to the store\");\n+          throw new RuntimeException(e);\n+        }\n+      }\n+    });\n+  }\n+\n+  @Override public <D extends Operation.Data, T, V extends Operation.Variables> void writeAndPublish(\n+      @Nonnull Operation<D, T, V> operation, @Nonnull D operationData) {\n+    Set<String> changedKeys = write(operation, operationData);","path":"apollo-runtime/src/main/java/com/apollographql/apollo/internal/cache/normalized/RealApolloStore.java","position":33,"original_position":33,"commit_id":"181541a9b1c2c14d66709765f7c7ca90e09e8cc3","original_commit_id":"181541a9b1c2c14d66709765f7c7ca90e09e8cc3","user":{"login":"sav007","id":902816,"avatar_url":"https://avatars1.githubusercontent.com/u/902816?v=3","gravatar_id":"","url":"https://api.github.com/users/sav007","html_url":"https://github.com/sav007","followers_url":"https://api.github.com/users/sav007/followers","following_url":"https://api.github.com/users/sav007/following{/other_user}","gists_url":"https://api.github.com/users/sav007/gists{/gist_id}","starred_url":"https://api.github.com/users/sav007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sav007/subscriptions","organizations_url":"https://api.github.com/users/sav007/orgs","repos_url":"https://api.github.com/users/sav007/repos","events_url":"https://api.github.com/users/sav007/events{/privacy}","received_events_url":"https://api.github.com/users/sav007/received_events","type":"User","site_admin":false},"body":"`@Nonnull` is just for syntax highlighting in IDE, but it doesn't mean user won't pass null as argument, and I think is better to fail first than fail later with unpredictable outcome.","created_at":"2017-07-04T15:57:12Z","updated_at":"2017-07-04T15:57:12Z","html_url":"https://github.com/apollographql/apollo-android/pull/541#discussion_r125502771","pull_request_url":"https://api.github.com/repos/apollographql/apollo-android/pulls/541","_links":{"self":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/comments/125502771"},"html":{"href":"https://github.com/apollographql/apollo-android/pull/541#discussion_r125502771"},"pull_request":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/541"}}},"pull_request":{"url":"https://api.github.com/repos/apollographql/apollo-android/pulls/541","id":128504726,"html_url":"https://github.com/apollographql/apollo-android/pull/541","diff_url":"https://github.com/apollographql/apollo-android/pull/541.diff","patch_url":"https://github.com/apollographql/apollo-android/pull/541.patch","issue_url":"https://api.github.com/repos/apollographql/apollo-android/issues/541","number":541,"state":"open","locked":false,"title":"Write fragments to the Apollo Store API","user":{"login":"sav007","id":902816,"avatar_url":"https://avatars1.githubusercontent.com/u/902816?v=3","gravatar_id":"","url":"https://api.github.com/users/sav007","html_url":"https://github.com/sav007","followers_url":"https://api.github.com/users/sav007/followers","following_url":"https://api.github.com/users/sav007/following{/other_user}","gists_url":"https://api.github.com/users/sav007/gists{/gist_id}","starred_url":"https://api.github.com/users/sav007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sav007/subscriptions","organizations_url":"https://api.github.com/users/sav007/orgs","repos_url":"https://api.github.com/users/sav007/repos","events_url":"https://api.github.com/users/sav007/events{/privacy}","received_events_url":"https://api.github.com/users/sav007/received_events","type":"User","site_admin":false},"body":"Part of #467","created_at":"2017-07-02T00:12:40Z","updated_at":"2017-07-04T15:57:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87de41a4ee620d30796612692f50c04c7e648131","assignee":null,"assignees":[],"requested_reviewers":[{"login":"BenSchwab","id":1754153,"avatar_url":"https://avatars3.githubusercontent.com/u/1754153?v=3","gravatar_id":"","url":"https://api.github.com/users/BenSchwab","html_url":"https://github.com/BenSchwab","followers_url":"https://api.github.com/users/BenSchwab/followers","following_url":"https://api.github.com/users/BenSchwab/following{/other_user}","gists_url":"https://api.github.com/users/BenSchwab/gists{/gist_id}","starred_url":"https://api.github.com/users/BenSchwab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenSchwab/subscriptions","organizations_url":"https://api.github.com/users/BenSchwab/orgs","repos_url":"https://api.github.com/users/BenSchwab/repos","events_url":"https://api.github.com/users/BenSchwab/events{/privacy}","received_events_url":"https://api.github.com/users/BenSchwab/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apollographql/apollo-android/pulls/541/commits","review_comments_url":"https://api.github.com/repos/apollographql/apollo-android/pulls/541/comments","review_comment_url":"https://api.github.com/repos/apollographql/apollo-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apollographql/apollo-android/issues/541/comments","statuses_url":"https://api.github.com/repos/apollographql/apollo-android/statuses/181541a9b1c2c14d66709765f7c7ca90e09e8cc3","head":{"label":"sav007:feature-467/write-fragments","ref":"feature-467/write-fragments","sha":"181541a9b1c2c14d66709765f7c7ca90e09e8cc3","user":{"login":"sav007","id":902816,"avatar_url":"https://avatars1.githubusercontent.com/u/902816?v=3","gravatar_id":"","url":"https://api.github.com/users/sav007","html_url":"https://github.com/sav007","followers_url":"https://api.github.com/users/sav007/followers","following_url":"https://api.github.com/users/sav007/following{/other_user}","gists_url":"https://api.github.com/users/sav007/gists{/gist_id}","starred_url":"https://api.github.com/users/sav007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sav007/subscriptions","organizations_url":"https://api.github.com/users/sav007/orgs","repos_url":"https://api.github.com/users/sav007/repos","events_url":"https://api.github.com/users/sav007/events{/privacy}","received_events_url":"https://api.github.com/users/sav007/received_events","type":"User","site_admin":false},"repo":{"id":75508760,"name":"apollo-android","full_name":"sav007/apollo-android","owner":{"login":"sav007","id":902816,"avatar_url":"https://avatars1.githubusercontent.com/u/902816?v=3","gravatar_id":"","url":"https://api.github.com/users/sav007","html_url":"https://github.com/sav007","followers_url":"https://api.github.com/users/sav007/followers","following_url":"https://api.github.com/users/sav007/following{/other_user}","gists_url":"https://api.github.com/users/sav007/gists{/gist_id}","starred_url":"https://api.github.com/users/sav007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sav007/subscriptions","organizations_url":"https://api.github.com/users/sav007/orgs","repos_url":"https://api.github.com/users/sav007/repos","events_url":"https://api.github.com/users/sav007/events{/privacy}","received_events_url":"https://api.github.com/users/sav007/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sav007/apollo-android","description":":pager: A strongly-typed, caching GraphQL client for Android, written in Java","fork":true,"url":"https://api.github.com/repos/sav007/apollo-android","forks_url":"https://api.github.com/repos/sav007/apollo-android/forks","keys_url":"https://api.github.com/repos/sav007/apollo-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sav007/apollo-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sav007/apollo-android/teams","hooks_url":"https://api.github.com/repos/sav007/apollo-android/hooks","issue_events_url":"https://api.github.com/repos/sav007/apollo-android/issues/events{/number}","events_url":"https://api.github.com/repos/sav007/apollo-android/events","assignees_url":"https://api.github.com/repos/sav007/apollo-android/assignees{/user}","branches_url":"https://api.github.com/repos/sav007/apollo-android/branches{/branch}","tags_url":"https://api.github.com/repos/sav007/apollo-android/tags","blobs_url":"https://api.github.com/repos/sav007/apollo-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sav007/apollo-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sav007/apollo-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/sav007/apollo-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sav007/apollo-android/statuses/{sha}","languages_url":"https://api.github.com/repos/sav007/apollo-android/languages","stargazers_url":"https://api.github.com/repos/sav007/apollo-android/stargazers","contributors_url":"https://api.github.com/repos/sav007/apollo-android/contributors","subscribers_url":"https://api.github.com/repos/sav007/apollo-android/subscribers","subscription_url":"https://api.github.com/repos/sav007/apollo-android/subscription","commits_url":"https://api.github.com/repos/sav007/apollo-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/sav007/apollo-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/sav007/apollo-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/sav007/apollo-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/sav007/apollo-android/contents/{+path}","compare_url":"https://api.github.com/repos/sav007/apollo-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sav007/apollo-android/merges","archive_url":"https://api.github.com/repos/sav007/apollo-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sav007/apollo-android/downloads","issues_url":"https://api.github.com/repos/sav007/apollo-android/issues{/number}","pulls_url":"https://api.github.com/repos/sav007/apollo-android/pulls{/number}","milestones_url":"https://api.github.com/repos/sav007/apollo-android/milestones{/number}","notifications_url":"https://api.github.com/repos/sav007/apollo-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sav007/apollo-android/labels{/name}","releases_url":"https://api.github.com/repos/sav007/apollo-android/releases{/id}","deployments_url":"https://api.github.com/repos/sav007/apollo-android/deployments","created_at":"2016-12-04T00:33:01Z","updated_at":"2017-05-15T16:56:25Z","pushed_at":"2017-07-02T00:22:50Z","git_url":"git://github.com/sav007/apollo-android.git","ssh_url":"git@github.com:sav007/apollo-android.git","clone_url":"https://github.com/sav007/apollo-android.git","svn_url":"https://github.com/sav007/apollo-android","homepage":"","size":136743,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"apollographql:master","ref":"master","sha":"d798db7b90e48c62ef04c3ed4c7673a559994f06","user":{"login":"apollographql","id":17189275,"avatar_url":"https://avatars3.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"repo":{"id":69469299,"name":"apollo-android","full_name":"apollographql/apollo-android","owner":{"login":"apollographql","id":17189275,"avatar_url":"https://avatars3.githubusercontent.com/u/17189275?v=3","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apollographql/apollo-android","description":":pager: A strongly-typed, caching GraphQL client for Android, written in Java","fork":false,"url":"https://api.github.com/repos/apollographql/apollo-android","forks_url":"https://api.github.com/repos/apollographql/apollo-android/forks","keys_url":"https://api.github.com/repos/apollographql/apollo-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apollographql/apollo-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apollographql/apollo-android/teams","hooks_url":"https://api.github.com/repos/apollographql/apollo-android/hooks","issue_events_url":"https://api.github.com/repos/apollographql/apollo-android/issues/events{/number}","events_url":"https://api.github.com/repos/apollographql/apollo-android/events","assignees_url":"https://api.github.com/repos/apollographql/apollo-android/assignees{/user}","branches_url":"https://api.github.com/repos/apollographql/apollo-android/branches{/branch}","tags_url":"https://api.github.com/repos/apollographql/apollo-android/tags","blobs_url":"https://api.github.com/repos/apollographql/apollo-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apollographql/apollo-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apollographql/apollo-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/apollographql/apollo-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apollographql/apollo-android/statuses/{sha}","languages_url":"https://api.github.com/repos/apollographql/apollo-android/languages","stargazers_url":"https://api.github.com/repos/apollographql/apollo-android/stargazers","contributors_url":"https://api.github.com/repos/apollographql/apollo-android/contributors","subscribers_url":"https://api.github.com/repos/apollographql/apollo-android/subscribers","subscription_url":"https://api.github.com/repos/apollographql/apollo-android/subscription","commits_url":"https://api.github.com/repos/apollographql/apollo-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/apollographql/apollo-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/apollographql/apollo-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/apollographql/apollo-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/apollographql/apollo-android/contents/{+path}","compare_url":"https://api.github.com/repos/apollographql/apollo-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apollographql/apollo-android/merges","archive_url":"https://api.github.com/repos/apollographql/apollo-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apollographql/apollo-android/downloads","issues_url":"https://api.github.com/repos/apollographql/apollo-android/issues{/number}","pulls_url":"https://api.github.com/repos/apollographql/apollo-android/pulls{/number}","milestones_url":"https://api.github.com/repos/apollographql/apollo-android/milestones{/number}","notifications_url":"https://api.github.com/repos/apollographql/apollo-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apollographql/apollo-android/labels{/name}","releases_url":"https://api.github.com/repos/apollographql/apollo-android/releases{/id}","deployments_url":"https://api.github.com/repos/apollographql/apollo-android/deployments","created_at":"2016-09-28T14:03:30Z","updated_at":"2017-07-04T15:07:43Z","pushed_at":"2017-07-03T22:23:47Z","git_url":"git://github.com/apollographql/apollo-android.git","ssh_url":"git@github.com:apollographql/apollo-android.git","clone_url":"https://github.com/apollographql/apollo-android.git","svn_url":"https://github.com/apollographql/apollo-android","homepage":"","size":136613,"stargazers_count":411,"watchers_count":411,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":24,"forks":49,"open_issues":24,"watchers":411,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/541"},"html":{"href":"https://github.com/apollographql/apollo-android/pull/541"},"issue":{"href":"https://api.github.com/repos/apollographql/apollo-android/issues/541"},"comments":{"href":"https://api.github.com/repos/apollographql/apollo-android/issues/541/comments"},"review_comments":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/541/comments"},"review_comment":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apollographql/apollo-android/pulls/541/commits"},"statuses":{"href":"https://api.github.com/repos/apollographql/apollo-android/statuses/181541a9b1c2c14d66709765f7c7ca90e09e8cc3"}}}}
{"actor":{"display_login":"sav007"}}