{"action":"created","comment":{"url":"https://api.github.com/repos/heroku/react-refetch/pulls/comments/55269305","id":55269305,"diff_hunk":"@@ -0,0 +1,13 @@\n+export default function assign(obj, ...sources) {","path":"src/utils/assign.js","position":1,"original_position":1,"commit_id":"46b14f0e1cb509df0d58cc9a12882185c4500df8","original_commit_id":"46b14f0e1cb509df0d58cc9a12882185c4500df8","user":{"login":"passcod","id":155787,"avatar_url":"https://avatars.githubusercontent.com/u/155787?v=3","gravatar_id":"","url":"https://api.github.com/users/passcod","html_url":"https://github.com/passcod","followers_url":"https://api.github.com/users/passcod/followers","following_url":"https://api.github.com/users/passcod/following{/other_user}","gists_url":"https://api.github.com/users/passcod/gists{/gist_id}","starred_url":"https://api.github.com/users/passcod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/passcod/subscriptions","organizations_url":"https://api.github.com/users/passcod/orgs","repos_url":"https://api.github.com/users/passcod/repos","events_url":"https://api.github.com/users/passcod/events{/privacy}","received_events_url":"https://api.github.com/users/passcod/received_events","type":"User","site_admin":false},"body":"Yeah @nfcampos mentioned the polyfill thing, but lodash wasn't already included, so I wrote that. I just checked the [`Object.assign` MDN page](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), and it shows an ES5 implementation which I believe is functionally equivalent to mine. We can revert to native `Object.assign`, as the code was already peppered with calls to it before this PR, though.","created_at":"2016-03-07T20:48:10Z","updated_at":"2016-03-07T20:48:10Z","html_url":"https://github.com/heroku/react-refetch/pull/76#discussion_r55269305","pull_request_url":"https://api.github.com/repos/heroku/react-refetch/pulls/76","_links":{"self":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/comments/55269305"},"html":{"href":"https://github.com/heroku/react-refetch/pull/76#discussion_r55269305"},"pull_request":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/76"}}},"pull_request":{"url":"https://api.github.com/repos/heroku/react-refetch/pulls/76","id":61806838,"html_url":"https://github.com/heroku/react-refetch/pull/76","diff_url":"https://github.com/heroku/react-refetch/pull/76.diff","patch_url":"https://github.com/heroku/react-refetch/pull/76.patch","issue_url":"https://api.github.com/repos/heroku/react-refetch/issues/76","number":76,"state":"open","locked":false,"title":"Add option to specify fetch implementation","user":{"login":"passcod","id":155787,"avatar_url":"https://avatars.githubusercontent.com/u/155787?v=3","gravatar_id":"","url":"https://api.github.com/users/passcod","html_url":"https://github.com/passcod","followers_url":"https://api.github.com/users/passcod/followers","following_url":"https://api.github.com/users/passcod/following{/other_user}","gists_url":"https://api.github.com/users/passcod/gists{/gist_id}","starred_url":"https://api.github.com/users/passcod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/passcod/subscriptions","organizations_url":"https://api.github.com/users/passcod/orgs","repos_url":"https://api.github.com/users/passcod/repos","events_url":"https://api.github.com/users/passcod/events{/privacy}","received_events_url":"https://api.github.com/users/passcod/received_events","type":"User","site_admin":false},"body":"PR for #75.\r\n\r\nI think that covers it, it's a pretty simple feature :) The core focus of this PR works, and perfectly: one can now override the fetch implementation on a `connect` call basis. But details remain:\r\n\r\nI'm not sure about the chaining configuration API. To be exact: I like the API, but I'm not too happy about how I implemented it, but that's what feedback is for, right? The way it works is it preserves the existing options hash so the implementation is simple, but provides the chaining API on top. The way I did the chaining means you can only use a single `.with*` to set the relevant option:\r\n\r\n```js\r\n// Possible due to the implementation, but discouraged:\r\n@connect({\r\n  usersFetch: '/example'\r\n}, { withFetch: fetch })\r\nclass Foo extends Component {}\r\n\r\n// Chaining (recommended for public use):\r\n@connect.withFetch(fetch)({ ... })\r\nclass Foo extends Component {}\r\n\r\n// Multiple chaining (doesn't work with current PR):\r\n@connect.withFetch(fetch).withRef()({ ... })\r\nclass Foo extends Component {}\r\n\r\n// \"Detached\" style (functionally the same thing)\r\nconst refetch = connect.withFetch(fetch).withRef()\r\n\r\n@refetch({ ... })\r\nclass Foo extends Component {}\r\n```\r\n\r\nI have (as you can see above) added the `withFetch` option chainer. If you think that is best done in future work detached from this PR, I will remove it.\r\n\r\nI have added a test for this. I have _not_, however, changed the rest of the tests around to use `withFetch` to do dependency injection instead of overwriting `window.fetch`, which is something @ryanbrainard [mentioned](https://github.com/heroku/react-refetch/issues/75#issuecomment-192032812) as a potential outcome of this PR.\r\n\r\nI have modified the `wrappedInstance` exception message to mention using `.withFetch()` instead of `{ withFetch: true }`. I should probably revert that? (As it may be a breaking change, and not particularly necessary to do in this PR.)\r\n\r\nReally, the only thing bugging me about this is the chaining option impl. If someone has an idea on how to better do it…","created_at":"2016-03-05T09:15:03Z","updated_at":"2016-03-07T20:48:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9df7bdd763cd24aaed84c9bd77545d7351406a6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/heroku/react-refetch/pulls/76/commits","review_comments_url":"https://api.github.com/repos/heroku/react-refetch/pulls/76/comments","review_comment_url":"https://api.github.com/repos/heroku/react-refetch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/heroku/react-refetch/issues/76/comments","statuses_url":"https://api.github.com/repos/heroku/react-refetch/statuses/46b14f0e1cb509df0d58cc9a12882185c4500df8","head":{"label":"passcod:custom-fetch","ref":"custom-fetch","sha":"46b14f0e1cb509df0d58cc9a12882185c4500df8","user":{"login":"passcod","id":155787,"avatar_url":"https://avatars.githubusercontent.com/u/155787?v=3","gravatar_id":"","url":"https://api.github.com/users/passcod","html_url":"https://github.com/passcod","followers_url":"https://api.github.com/users/passcod/followers","following_url":"https://api.github.com/users/passcod/following{/other_user}","gists_url":"https://api.github.com/users/passcod/gists{/gist_id}","starred_url":"https://api.github.com/users/passcod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/passcod/subscriptions","organizations_url":"https://api.github.com/users/passcod/orgs","repos_url":"https://api.github.com/users/passcod/repos","events_url":"https://api.github.com/users/passcod/events{/privacy}","received_events_url":"https://api.github.com/users/passcod/received_events","type":"User","site_admin":false},"repo":{"id":53127857,"name":"react-refetch","full_name":"passcod/react-refetch","owner":{"login":"passcod","id":155787,"avatar_url":"https://avatars.githubusercontent.com/u/155787?v=3","gravatar_id":"","url":"https://api.github.com/users/passcod","html_url":"https://github.com/passcod","followers_url":"https://api.github.com/users/passcod/followers","following_url":"https://api.github.com/users/passcod/following{/other_user}","gists_url":"https://api.github.com/users/passcod/gists{/gist_id}","starred_url":"https://api.github.com/users/passcod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/passcod/subscriptions","organizations_url":"https://api.github.com/users/passcod/orgs","repos_url":"https://api.github.com/users/passcod/repos","events_url":"https://api.github.com/users/passcod/events{/privacy}","received_events_url":"https://api.github.com/users/passcod/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/passcod/react-refetch","description":"A simple, declarative, and composable way to fetch data for React components","fork":true,"url":"https://api.github.com/repos/passcod/react-refetch","forks_url":"https://api.github.com/repos/passcod/react-refetch/forks","keys_url":"https://api.github.com/repos/passcod/react-refetch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/passcod/react-refetch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/passcod/react-refetch/teams","hooks_url":"https://api.github.com/repos/passcod/react-refetch/hooks","issue_events_url":"https://api.github.com/repos/passcod/react-refetch/issues/events{/number}","events_url":"https://api.github.com/repos/passcod/react-refetch/events","assignees_url":"https://api.github.com/repos/passcod/react-refetch/assignees{/user}","branches_url":"https://api.github.com/repos/passcod/react-refetch/branches{/branch}","tags_url":"https://api.github.com/repos/passcod/react-refetch/tags","blobs_url":"https://api.github.com/repos/passcod/react-refetch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/passcod/react-refetch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/passcod/react-refetch/git/refs{/sha}","trees_url":"https://api.github.com/repos/passcod/react-refetch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/passcod/react-refetch/statuses/{sha}","languages_url":"https://api.github.com/repos/passcod/react-refetch/languages","stargazers_url":"https://api.github.com/repos/passcod/react-refetch/stargazers","contributors_url":"https://api.github.com/repos/passcod/react-refetch/contributors","subscribers_url":"https://api.github.com/repos/passcod/react-refetch/subscribers","subscription_url":"https://api.github.com/repos/passcod/react-refetch/subscription","commits_url":"https://api.github.com/repos/passcod/react-refetch/commits{/sha}","git_commits_url":"https://api.github.com/repos/passcod/react-refetch/git/commits{/sha}","comments_url":"https://api.github.com/repos/passcod/react-refetch/comments{/number}","issue_comment_url":"https://api.github.com/repos/passcod/react-refetch/issues/comments{/number}","contents_url":"https://api.github.com/repos/passcod/react-refetch/contents/{+path}","compare_url":"https://api.github.com/repos/passcod/react-refetch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/passcod/react-refetch/merges","archive_url":"https://api.github.com/repos/passcod/react-refetch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/passcod/react-refetch/downloads","issues_url":"https://api.github.com/repos/passcod/react-refetch/issues{/number}","pulls_url":"https://api.github.com/repos/passcod/react-refetch/pulls{/number}","milestones_url":"https://api.github.com/repos/passcod/react-refetch/milestones{/number}","notifications_url":"https://api.github.com/repos/passcod/react-refetch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/passcod/react-refetch/labels{/name}","releases_url":"https://api.github.com/repos/passcod/react-refetch/releases{/id}","deployments_url":"https://api.github.com/repos/passcod/react-refetch/deployments","created_at":"2016-03-04T10:32:48Z","updated_at":"2016-03-04T10:32:49Z","pushed_at":"2016-03-06T06:57:07Z","git_url":"git://github.com/passcod/react-refetch.git","ssh_url":"git@github.com:passcod/react-refetch.git","clone_url":"https://github.com/passcod/react-refetch.git","svn_url":"https://github.com/passcod/react-refetch","homepage":"https://engineering.heroku.com/blogs/2015-12-16-react-refetch/","size":326,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"heroku:master","ref":"master","sha":"fead46b6d0a26407be30527fbf2719c2ebaa99a5","user":{"login":"heroku","id":23211,"avatar_url":"https://avatars.githubusercontent.com/u/23211?v=3","gravatar_id":"","url":"https://api.github.com/users/heroku","html_url":"https://github.com/heroku","followers_url":"https://api.github.com/users/heroku/followers","following_url":"https://api.github.com/users/heroku/following{/other_user}","gists_url":"https://api.github.com/users/heroku/gists{/gist_id}","starred_url":"https://api.github.com/users/heroku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heroku/subscriptions","organizations_url":"https://api.github.com/users/heroku/orgs","repos_url":"https://api.github.com/users/heroku/repos","events_url":"https://api.github.com/users/heroku/events{/privacy}","received_events_url":"https://api.github.com/users/heroku/received_events","type":"Organization","site_admin":false},"repo":{"id":46009648,"name":"react-refetch","full_name":"heroku/react-refetch","owner":{"login":"heroku","id":23211,"avatar_url":"https://avatars.githubusercontent.com/u/23211?v=3","gravatar_id":"","url":"https://api.github.com/users/heroku","html_url":"https://github.com/heroku","followers_url":"https://api.github.com/users/heroku/followers","following_url":"https://api.github.com/users/heroku/following{/other_user}","gists_url":"https://api.github.com/users/heroku/gists{/gist_id}","starred_url":"https://api.github.com/users/heroku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heroku/subscriptions","organizations_url":"https://api.github.com/users/heroku/orgs","repos_url":"https://api.github.com/users/heroku/repos","events_url":"https://api.github.com/users/heroku/events{/privacy}","received_events_url":"https://api.github.com/users/heroku/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/heroku/react-refetch","description":"A simple, declarative, and composable way to fetch data for React components","fork":false,"url":"https://api.github.com/repos/heroku/react-refetch","forks_url":"https://api.github.com/repos/heroku/react-refetch/forks","keys_url":"https://api.github.com/repos/heroku/react-refetch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/heroku/react-refetch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/heroku/react-refetch/teams","hooks_url":"https://api.github.com/repos/heroku/react-refetch/hooks","issue_events_url":"https://api.github.com/repos/heroku/react-refetch/issues/events{/number}","events_url":"https://api.github.com/repos/heroku/react-refetch/events","assignees_url":"https://api.github.com/repos/heroku/react-refetch/assignees{/user}","branches_url":"https://api.github.com/repos/heroku/react-refetch/branches{/branch}","tags_url":"https://api.github.com/repos/heroku/react-refetch/tags","blobs_url":"https://api.github.com/repos/heroku/react-refetch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/heroku/react-refetch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/heroku/react-refetch/git/refs{/sha}","trees_url":"https://api.github.com/repos/heroku/react-refetch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/heroku/react-refetch/statuses/{sha}","languages_url":"https://api.github.com/repos/heroku/react-refetch/languages","stargazers_url":"https://api.github.com/repos/heroku/react-refetch/stargazers","contributors_url":"https://api.github.com/repos/heroku/react-refetch/contributors","subscribers_url":"https://api.github.com/repos/heroku/react-refetch/subscribers","subscription_url":"https://api.github.com/repos/heroku/react-refetch/subscription","commits_url":"https://api.github.com/repos/heroku/react-refetch/commits{/sha}","git_commits_url":"https://api.github.com/repos/heroku/react-refetch/git/commits{/sha}","comments_url":"https://api.github.com/repos/heroku/react-refetch/comments{/number}","issue_comment_url":"https://api.github.com/repos/heroku/react-refetch/issues/comments{/number}","contents_url":"https://api.github.com/repos/heroku/react-refetch/contents/{+path}","compare_url":"https://api.github.com/repos/heroku/react-refetch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/heroku/react-refetch/merges","archive_url":"https://api.github.com/repos/heroku/react-refetch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/heroku/react-refetch/downloads","issues_url":"https://api.github.com/repos/heroku/react-refetch/issues{/number}","pulls_url":"https://api.github.com/repos/heroku/react-refetch/pulls{/number}","milestones_url":"https://api.github.com/repos/heroku/react-refetch/milestones{/number}","notifications_url":"https://api.github.com/repos/heroku/react-refetch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/heroku/react-refetch/labels{/name}","releases_url":"https://api.github.com/repos/heroku/react-refetch/releases{/id}","deployments_url":"https://api.github.com/repos/heroku/react-refetch/deployments","created_at":"2015-11-11T21:02:02Z","updated_at":"2016-03-07T15:57:52Z","pushed_at":"2016-03-07T18:43:03Z","git_url":"git://github.com/heroku/react-refetch.git","ssh_url":"git@github.com:heroku/react-refetch.git","clone_url":"https://github.com/heroku/react-refetch.git","svn_url":"https://github.com/heroku/react-refetch","homepage":"https://engineering.heroku.com/blogs/2015-12-16-react-refetch/","size":342,"stargazers_count":1648,"watchers_count":1648,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":16,"forks":50,"open_issues":16,"watchers":1648,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/76"},"html":{"href":"https://github.com/heroku/react-refetch/pull/76"},"issue":{"href":"https://api.github.com/repos/heroku/react-refetch/issues/76"},"comments":{"href":"https://api.github.com/repos/heroku/react-refetch/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/heroku/react-refetch/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/heroku/react-refetch/statuses/46b14f0e1cb509df0d58cc9a12882185c4500df8"}}}}