{"action":"created","comment":{"url":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments/69340110","id":69340110,"diff_hunk":"@@ -3,63 +3,134 @@\n import {\n   Selection,\n   Variable,\n-  BooleanValue,\n+  StringValue,\n+  Directive,\n+  GraphQLDirective,\n+  GraphQLIncludeDirective,\n+  GraphQLSkipDirective,\n+  GraphQLDeprecatedDirective,\n+  GraphQLNonNull,\n+  GraphQLScalarType,\n+  GraphQLString,\n+  GraphQLBoolean,\n } from 'graphql';\n \n+export const apolloFetchMoreDirective = new GraphQLDirective(({","path":"src/queries/directives.ts","position":17,"original_position":17,"commit_id":"11658037c7e007209de4e56ca7b60f9ad184a2bf","original_commit_id":"11658037c7e007209de4e56ca7b60f9ad184a2bf","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":"Hey, we're currently in the process of removing the dependency on the `graphql` package, since it's blocking React Native support. Do we actually need this GraphQLDirective definition on the code? I assume this constructor doesn't do much, and we can just use the plain JS object in `validateDirectives`.","created_at":"2016-07-01T18:38:04Z","updated_at":"2016-07-01T18:38:04Z","html_url":"https://github.com/apollostack/apollo-client/pull/335#discussion_r69340110","pull_request_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/335","_links":{"self":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/comments/69340110"},"html":{"href":"https://github.com/apollostack/apollo-client/pull/335#discussion_r69340110"},"pull_request":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/335"}}},"pull_request":{"url":"https://api.github.com/repos/apollostack/apollo-client/pulls/335","id":75613198,"html_url":"https://github.com/apollostack/apollo-client/pull/335","diff_url":"https://github.com/apollostack/apollo-client/pull/335.diff","patch_url":"https://github.com/apollostack/apollo-client/pull/335.patch","issue_url":"https://api.github.com/repos/apollostack/apollo-client/issues/335","number":335,"state":"open","locked":false,"title":"[WIP] Fetch more / Infinite Scroll","user":{"login":"rricard","id":246520,"avatar_url":"https://avatars.githubusercontent.com/u/246520?v=3","gravatar_id":"","url":"https://api.github.com/users/rricard","html_url":"https://github.com/rricard","followers_url":"https://api.github.com/users/rricard/followers","following_url":"https://api.github.com/users/rricard/following{/other_user}","gists_url":"https://api.github.com/users/rricard/gists{/gist_id}","starred_url":"https://api.github.com/users/rricard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rricard/subscriptions","organizations_url":"https://api.github.com/users/rricard/orgs","repos_url":"https://api.github.com/users/rricard/repos","events_url":"https://api.github.com/users/rricard/events{/privacy}","received_events_url":"https://api.github.com/users/rricard/received_events","type":"User","site_admin":false},"body":"Adds a fetchMore method able to fetch new data and concatenate it into the store, performing, that way, an infinite scroll behavior!\r\n\r\nTODO:\r\n\r\n- [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\r\n- [x] change `concatPaths: Array<string>` to `paginationParameters: Array<string>`, that way suppressing for special paths those parameters from the store ids. (ex: instead of `ROOT_QUERY.allPosts({cursor: 'x', type: 'y'})`, if `paginationParameters: {'ROOT_QUERY.allPosts': ['cursor']}` is set, it will only be `ROOT_QUERY.allPosts({type: 'y'})`\r\n- [x] Implement correct resolution of paths\r\n- [x] Squash!\r\n- [x] `paginationParameters` => `quietArguments`\r\n- [x] Backwards concat possible\r\n- [x] Add directive for pagination !\r\n- [x] Add a per-directive merge option\r\n- [x] Add a directive selection in the fetch more to avoid fetching more of everything\r\n- [x] fetch more can override query-level opts\r\n- [x] embed into the directive common merging use cases: `append/prepend/sort`\r\n- [x] Make sure is correctly wired (`fetchMore()` to the public API, `paginationParameters` everytime there is some store access & `fetchMore everytime we're doing a query)\r\n- [x] Do a proper system to handle directives (right now it's clearly hacky) => **REFACTOR!**\r\n- [x] So do MORE TESTS and/or integrate with existing tests to take `paginationParameters` in account.\r\n- [ ] Directive removal before sending the query to the server! *OR* PR on the server to support the directive there (by adding it to the schema! Maybe somewhere in `graphql-tools`)\r\n- [ ] Add it to the docs!\r\n\r\n## Basic usage example:\r\n\r\n```js\r\nlet latest_name = null;\r\nconst subscription = client.watchQuery({\r\n  query: gql`\r\n    all_people(latest_name: $latest_name, type: $type) @apolloFetchMore {\r\n       name\r\n    }\r\n  `,\r\n  quietArguments: ['latest_name'],\r\n  variables: {\r\n    type: 'Jedi',\r\n    latest_name: null,\r\n  },\r\n}).subscribe({\r\n  next(result) {\r\n    console.log(result);\r\n    // First value => {all_people: [{name: 'Luke SkyWalker'}]}\r\n    // Second value => {all_people: [{name: 'Luke SkyWalker'}, {name: 'Obi-Wan Kenobi'}]}\r\n    const new_latest_name = result.all_people[result.all_people.length -1];\r\n    if(new_latest_name !== latest_name) {\r\n      latest_name = new_latest_name;\r\n      subscription.refetchMore({latest_name});\r\n    }\r\n  }\r\n});\r\n```\r\n\r\n## Advanced usage example:\r\n\r\n```js\r\nlet latest_name = null;\r\nconst subscription = client.watchQuery({\r\n  query: gql`\r\n    messages(cursor: $chatCur) @apolloFetchMore(name: \"messages\") {\r\n      content\r\n      replies @apolloFetchMore(name: \"replies\") {\r\n         content\r\n       }\r\n    }\r\n  `,\r\n  quietArguments: ['cursor'],\r\n  variables: {\r\n    chatCur: null,\r\n  },\r\n  mergeResults: {\r\n    messages: (oldArr, newArr) => [].concat(newArr, oldArr),\r\n  }\r\n}).subscribe({\r\n  next(result) {\r\n    console.log(result);\r\n    setTimeout(() => {\r\n      subscription.refetchMore({targetedFetchMoreDirectives: ['replies']});\r\n    }, 60000);\r\n    setTimeout(() => {\r\n      subscription.refetchMore({targetedFetchMoreDirectives: ['messages']});\r\n    }, 10000);\r\n  }\r\n});\r\n```\r\n\r\n\r\n## Advanced usage example with directives only!:\r\n\r\n```js\r\nlet latest_name = null;\r\nconst subscription = client.watchQuery({\r\n  query: gql`\r\n    messages(cursor: $chatCur) @apolloFetchMore(name: \"messages\", quiet: \"cursor\", prepend: true) {\r\n      content\r\n      replies @apolloFetchMore(name: \"replies\") {\r\n         content\r\n       }\r\n    }\r\n  `,\r\n  variables: {\r\n    chatCur: null,\r\n  },\r\n}).subscribe({\r\n  next(result) {\r\n    console.log(result);\r\n    setTimeout(() => {\r\n      subscription.refetchMore({targetedFetchMoreDirectives: ['replies']});\r\n    }, 60000);\r\n    setTimeout(() => {\r\n      subscription.refetchMore({targetedFetchMoreDirectives: ['messages']});\r\n    }, 10000);\r\n  }\r\n});\r\n```","created_at":"2016-06-29T09:12:42Z","updated_at":"2016-07-01T18:38:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e3c22d61ea66dba22085ba65cda3b9685686641","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/335/commits","review_comments_url":"https://api.github.com/repos/apollostack/apollo-client/pulls/335/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/335/comments","statuses_url":"https://api.github.com/repos/apollostack/apollo-client/statuses/11658037c7e007209de4e56ca7b60f9ad184a2bf","head":{"label":"rricard:fetch-more","ref":"fetch-more","sha":"11658037c7e007209de4e56ca7b60f9ad184a2bf","user":{"login":"rricard","id":246520,"avatar_url":"https://avatars.githubusercontent.com/u/246520?v=3","gravatar_id":"","url":"https://api.github.com/users/rricard","html_url":"https://github.com/rricard","followers_url":"https://api.github.com/users/rricard/followers","following_url":"https://api.github.com/users/rricard/following{/other_user}","gists_url":"https://api.github.com/users/rricard/gists{/gist_id}","starred_url":"https://api.github.com/users/rricard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rricard/subscriptions","organizations_url":"https://api.github.com/users/rricard/orgs","repos_url":"https://api.github.com/users/rricard/repos","events_url":"https://api.github.com/users/rricard/events{/privacy}","received_events_url":"https://api.github.com/users/rricard/received_events","type":"User","site_admin":false},"repo":{"id":62134840,"name":"apollo-client","full_name":"rricard/apollo-client","owner":{"login":"rricard","id":246520,"avatar_url":"https://avatars.githubusercontent.com/u/246520?v=3","gravatar_id":"","url":"https://api.github.com/users/rricard","html_url":"https://github.com/rricard","followers_url":"https://api.github.com/users/rricard/followers","following_url":"https://api.github.com/users/rricard/following{/other_user}","gists_url":"https://api.github.com/users/rricard/gists{/gist_id}","starred_url":"https://api.github.com/users/rricard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rricard/subscriptions","organizations_url":"https://api.github.com/users/rricard/orgs","repos_url":"https://api.github.com/users/rricard/repos","events_url":"https://api.github.com/users/rricard/events{/privacy}","received_events_url":"https://api.github.com/users/rricard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rricard/apollo-client","description":":rocket: A simple caching client for any GraphQL server and UI framework","fork":true,"url":"https://api.github.com/repos/rricard/apollo-client","forks_url":"https://api.github.com/repos/rricard/apollo-client/forks","keys_url":"https://api.github.com/repos/rricard/apollo-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rricard/apollo-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rricard/apollo-client/teams","hooks_url":"https://api.github.com/repos/rricard/apollo-client/hooks","issue_events_url":"https://api.github.com/repos/rricard/apollo-client/issues/events{/number}","events_url":"https://api.github.com/repos/rricard/apollo-client/events","assignees_url":"https://api.github.com/repos/rricard/apollo-client/assignees{/user}","branches_url":"https://api.github.com/repos/rricard/apollo-client/branches{/branch}","tags_url":"https://api.github.com/repos/rricard/apollo-client/tags","blobs_url":"https://api.github.com/repos/rricard/apollo-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rricard/apollo-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rricard/apollo-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/rricard/apollo-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rricard/apollo-client/statuses/{sha}","languages_url":"https://api.github.com/repos/rricard/apollo-client/languages","stargazers_url":"https://api.github.com/repos/rricard/apollo-client/stargazers","contributors_url":"https://api.github.com/repos/rricard/apollo-client/contributors","subscribers_url":"https://api.github.com/repos/rricard/apollo-client/subscribers","subscription_url":"https://api.github.com/repos/rricard/apollo-client/subscription","commits_url":"https://api.github.com/repos/rricard/apollo-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/rricard/apollo-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/rricard/apollo-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/rricard/apollo-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/rricard/apollo-client/contents/{+path}","compare_url":"https://api.github.com/repos/rricard/apollo-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rricard/apollo-client/merges","archive_url":"https://api.github.com/repos/rricard/apollo-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rricard/apollo-client/downloads","issues_url":"https://api.github.com/repos/rricard/apollo-client/issues{/number}","pulls_url":"https://api.github.com/repos/rricard/apollo-client/pulls{/number}","milestones_url":"https://api.github.com/repos/rricard/apollo-client/milestones{/number}","notifications_url":"https://api.github.com/repos/rricard/apollo-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rricard/apollo-client/labels{/name}","releases_url":"https://api.github.com/repos/rricard/apollo-client/releases{/id}","deployments_url":"https://api.github.com/repos/rricard/apollo-client/deployments","created_at":"2016-06-28T11:16:00Z","updated_at":"2016-06-28T11:16:01Z","pushed_at":"2016-07-01T17:55:02Z","git_url":"git://github.com/rricard/apollo-client.git","ssh_url":"git@github.com:rricard/apollo-client.git","clone_url":"https://github.com/rricard/apollo-client.git","svn_url":"https://github.com/rricard/apollo-client","homepage":"http://docs.apollostack.com/apollo-client/","size":1005,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apollostack:master","ref":"master","sha":"29b2e932b53a55d05d48e3fcb58e09574d218bf6","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-01T17:20:56Z","pushed_at":"2016-07-01T18:00:52Z","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":1069,"stargazers_count":589,"watchers_count":589,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":40,"mirror_url":null,"open_issues_count":63,"forks":40,"open_issues":63,"watchers":589,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/335"},"html":{"href":"https://github.com/apollostack/apollo-client/pull/335"},"issue":{"href":"https://api.github.com/repos/apollostack/apollo-client/issues/335"},"comments":{"href":"https://api.github.com/repos/apollostack/apollo-client/issues/335/comments"},"review_comments":{"href":"https://api.github.com/repos/apollostack/apollo-client/pulls/335/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/335/commits"},"statuses":{"href":"https://api.github.com/repos/apollostack/apollo-client/statuses/11658037c7e007209de4e56ca7b60f9ad184a2bf"}}}}
{"actor":{"display_login":"stubailo"}}