{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/52009044","id":52009044,"diff_hunk":"@@ -2,40 +2,40 @@\n  * Internal Dependencies\n  */\n import { action as InvitesActionTypes } from 'lib/invites/constants';\n+import SitesList from './list';\n+import PollerPool from 'lib/data-poller';\n+import Dispatcher from 'dispatcher';\n \n-var SitesList = require( './list' ),\n-\tPollerPool = require( 'lib/data-poller' ),\n-\tDispatcher = require( 'dispatcher' ),\n-\t_sites;\n+var sites;\n \n module.exports = function() {\n-\tif ( ! _sites ) {\n-\t\t_sites = new SitesList();\n-\t\tPollerPool.add( _sites, 'fetch' );\n+\tif ( ! sites ) {\n+\t\tsites = new SitesList();\n+\t\tPollerPool.add( sites, 'fetch' );\n \n-\t\t_sites.dispatchToken = Dispatcher.register( function( payload ) {\n+\t\tsites.dispatchToken = Dispatcher.register( function( payload ) {\n \t\t\tvar action = payload.action;\n \t\t\tswitch ( action.type ) {\n \t\t\t\tcase 'DISCONNECT_SITE':\n \t\t\t\tcase 'RECEIVE_DELETED_SITE':\n-\t\t\t\t\t_sites.removeSite( action.site );\n+\t\t\t\t\tsites.removeSite( action.site );\n \t\t\t\t\tbreak;\n \t\t\t\tcase InvitesActionTypes.RECEIVE_INVITE_ACCEPTED_SUCCESS:\n \t\t\t\t\tif ( [ 'follower', 'viewer' ].indexOf( action.invite.role ) === -1 ) {\n-\t\t\t\t\t\t_sites.sync( action.data );\n+\t\t\t\t\t\tsites.sync( action.data );\n \t\t\t\t\t}\n \t\t\t\t\tbreak;\n \t\t\t\tcase 'RECEIVE_DISCONNECTED_SITE':\n-\t\t\t\tcase 'FETCH_SITES':\n-\t\t\t\t\t_sites.fetch(); // refetch the sites from .com\n+\t\t\t\tcase 'FETCHsites':","path":"client/lib/sites-list/index.js","position":40,"original_position":40,"commit_id":"058a99b522be9c7123b690e6e2d68cbd9def5c1b","original_commit_id":"7d3215ca80442ea7f51ec8ba1e35564107904f5d","user":{"login":"retrofox","id":77539,"avatar_url":"https://avatars.githubusercontent.com/u/77539?v=3","gravatar_id":"","url":"https://api.github.com/users/retrofox","html_url":"https://github.com/retrofox","followers_url":"https://api.github.com/users/retrofox/followers","following_url":"https://api.github.com/users/retrofox/following{/other_user}","gists_url":"https://api.github.com/users/retrofox/gists{/gist_id}","starred_url":"https://api.github.com/users/retrofox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retrofox/subscriptions","organizations_url":"https://api.github.com/users/retrofox/orgs","repos_url":"https://api.github.com/users/retrofox/repos","events_url":"https://api.github.com/users/retrofox/events{/privacy}","received_events_url":"https://api.github.com/users/retrofox/received_events","type":"User","site_admin":false},"body":"my bad.","created_at":"2016-02-05T12:14:36Z","updated_at":"2016-02-05T12:14:36Z","html_url":"https://github.com/Automattic/wp-calypso/pull/2843#discussion_r52009044","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/52009044"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/2843#discussion_r52009044"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843","id":57403814,"html_url":"https://github.com/Automattic/wp-calypso/pull/2843","diff_url":"https://github.com/Automattic/wp-calypso/pull/2843.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/2843.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/2843","number":2843,"state":"open","locked":false,"title":"Framework: Add sync-handler wrapper","user":{"login":"retrofox","id":77539,"avatar_url":"https://avatars.githubusercontent.com/u/77539?v=3","gravatar_id":"","url":"https://api.github.com/users/retrofox","html_url":"https://github.com/retrofox","followers_url":"https://api.github.com/users/retrofox/followers","following_url":"https://api.github.com/users/retrofox/following{/other_user}","gists_url":"https://api.github.com/users/retrofox/gists{/gist_id}","starred_url":"https://api.github.com/users/retrofox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retrofox/subscriptions","organizations_url":"https://api.github.com/users/retrofox/orgs","repos_url":"https://api.github.com/users/retrofox/repos","events_url":"https://api.github.com/users/retrofox/events{/privacy}","received_events_url":"https://api.github.com/users/retrofox/received_events","type":"User","site_admin":false},"body":"This adds a wrapper to sync the data gotten from the REST-API GET responses.\r\nThe idea with this data storing is allow provide data when the user is offline. \r\n\r\nThis wrapper works like a middleware that intercepts every GET request from the user and does, in short, three actions:\r\n\r\n1) Search the data locally in response immediately if this exists.\r\n2) At the same time send the request to WordPress REST-API server.\r\n3) Update the WP response locally\r\n\r\n**_This approach is not ready to production. This feature is allowed through of its `sync-handler` config key._**","created_at":"2016-01-27T18:43:46Z","updated_at":"2016-02-05T12:14:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9e895428653d0f5d96e75a9c5108fd0f2baf405","assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/54","html_url":"https://github.com/Automattic/wp-calypso/milestones/Calypso%20Core:%20Offline%203","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/54/labels","id":1546929,"number":54,"title":"Calypso Core: Offline 3","description":"Finish up our meetup project for posting in the desktop editor while offline.","creator":{"login":"rralian","id":134044,"avatar_url":"https://avatars.githubusercontent.com/u/134044?v=3","gravatar_id":"","url":"https://api.github.com/users/rralian","html_url":"https://github.com/rralian","followers_url":"https://api.github.com/users/rralian/followers","following_url":"https://api.github.com/users/rralian/following{/other_user}","gists_url":"https://api.github.com/users/rralian/gists{/gist_id}","starred_url":"https://api.github.com/users/rralian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rralian/subscriptions","organizations_url":"https://api.github.com/users/rralian/orgs","repos_url":"https://api.github.com/users/rralian/repos","events_url":"https://api.github.com/users/rralian/events{/privacy}","received_events_url":"https://api.github.com/users/rralian/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":1,"state":"open","created_at":"2016-01-27T18:48:25Z","updated_at":"2016-02-05T01:17:44Z","due_on":"2016-02-09T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843/comments","review_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/2843/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/058a99b522be9c7123b690e6e2d68cbd9def5c1b","head":{"label":"Automattic:add/sync-handler-wrapper","ref":"add/sync-handler-wrapper","sha":"058a99b522be9c7123b690e6e2d68cbd9def5c1b","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-02-05T09:16:45Z","pushed_at":"2016-02-05T12:06:05Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":54202,"stargazers_count":6753,"watchers_count":6753,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":763,"mirror_url":null,"open_issues_count":1217,"forks":763,"open_issues":1217,"watchers":6753,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"da2a1bce237327c81fabc1903d63c7efb04fd03b","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-02-05T09:16:45Z","pushed_at":"2016-02-05T12:06:05Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":54202,"stargazers_count":6753,"watchers_count":6753,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":763,"mirror_url":null,"open_issues_count":1217,"forks":763,"open_issues":1217,"watchers":6753,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/2843"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/2843"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/2843/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/2843/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/058a99b522be9c7123b690e6e2d68cbd9def5c1b"}}}}