{"action":"created","comment":{"url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/comments/89652858","pull_request_review_id":10198148,"id":89652858,"diff_hunk":"@@ -0,0 +1,65 @@\n+import Immutable from 'immutable'\n+import {getComponentName} from './utils'\n+import {SELECTOR, PLACEHOLDER} from '../containers/app/constants'\n+\n+/**\n+ * A pattern where slices of state \"cache\" data keyed to URLs.\n+ * A `selector` value holds the currently routed URL.\n+ *\n+ * For example,\n+ *   state: {\n+ *     plp: {\n+ *       \"selector\": \"http://www.merlinspotions.com/potions.html\",\n+ *       \"placeholder\": {\n+ *         // Skeleton when switching between pages\n+ *       },\n+ *       \"http://www.merlinspotions.com/potions.html\": {\n+ *         // PLP - Potions\n+ *       },\n+ *       \"http://www.merlinspotions.com/books.html\": {\n+ *         // PLP - Books\n+ *       }\n+ *     }\n+ *   }\n+ */\n+\n+\n+/**\n+ * Determine whether the page received corresponds to the component we care about\n+ */\n+export const isPageType = (pageType, component) => pageType === getComponentName(component)\n+\n+/**\n+ * Determine whether we should display content or transition into a placeholder state\n+ */\n+export const getNextSelector = (state, currentURL) => { return state.has(currentURL) ? currentURL : PLACEHOLDER }\n+\n+\n+/**\n+ * Takes a slice of state and returns the key of the current route\n+ */\n+export const getSelectorFromState = (state) => {\n+    return state.get(SELECTOR)\n+}\n+\n+/**\n+ * Takes a slice of state and returns the data mapped to the current route\n+ *\n+ * eg. plp > 'http://www.merlinspotions.com/potions.html' > {data}\n+ */\n+export const getRoutedState = (state) => {","path":"app/utils/router-utils.js","position":50,"original_position":50,"commit_id":"d46cb0ad01d3995e73975e195e9f4e942067a953","original_commit_id":"d46cb0ad01d3995e73975e195e9f4e942067a953","user":{"login":"fractaltheory","id":1211726,"avatar_url":"https://avatars.githubusercontent.com/u/1211726?v=3","gravatar_id":"","url":"https://api.github.com/users/fractaltheory","html_url":"https://github.com/fractaltheory","followers_url":"https://api.github.com/users/fractaltheory/followers","following_url":"https://api.github.com/users/fractaltheory/following{/other_user}","gists_url":"https://api.github.com/users/fractaltheory/gists{/gist_id}","starred_url":"https://api.github.com/users/fractaltheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractaltheory/subscriptions","organizations_url":"https://api.github.com/users/fractaltheory/orgs","repos_url":"https://api.github.com/users/fractaltheory/repos","events_url":"https://api.github.com/users/fractaltheory/events{/privacy}","received_events_url":"https://api.github.com/users/fractaltheory/received_events","type":"User","site_admin":false},"body":"Same thing here, as above","created_at":"2016-11-25T19:42:11Z","updated_at":"2016-11-25T19:42:11Z","html_url":"https://github.com/mobify/progressive-web-scaffold/pull/174#discussion_r89652858","pull_request_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174","_links":{"self":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/comments/89652858"},"html":{"href":"https://github.com/mobify/progressive-web-scaffold/pull/174#discussion_r89652858"},"pull_request":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174"}}},"pull_request":{"url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174","id":94730834,"html_url":"https://github.com/mobify/progressive-web-scaffold/pull/174","diff_url":"https://github.com/mobify/progressive-web-scaffold/pull/174.diff","patch_url":"https://github.com/mobify/progressive-web-scaffold/pull/174.patch","issue_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/174","number":174,"state":"open","locked":false,"title":"\"Cache\" data in the redux store, keyed to their URLs","user":{"login":"guisers","id":8797909,"avatar_url":"https://avatars.githubusercontent.com/u/8797909?v=3","gravatar_id":"","url":"https://api.github.com/users/guisers","html_url":"https://github.com/guisers","followers_url":"https://api.github.com/users/guisers/followers","following_url":"https://api.github.com/users/guisers/following{/other_user}","gists_url":"https://api.github.com/users/guisers/gists{/gist_id}","starred_url":"https://api.github.com/users/guisers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guisers/subscriptions","organizations_url":"https://api.github.com/users/guisers/orgs","repos_url":"https://api.github.com/users/guisers/repos","events_url":"https://api.github.com/users/guisers/events{/privacy}","received_events_url":"https://api.github.com/users/guisers/received_events","type":"User","site_admin":false},"body":"A pattern where slices of state \"cache\" data keyed to URLs. The currently routed URL is determined by a `selector` value in that slice of state. Skeleton data is keyed to `placeholder` for use during transitions. Also allow PDP to listen to PLP page received to prepopulate some basic data.\r\n\r\n **JIRA**: https://mobify.atlassian.net/browse/WEB-994\r\n\r\n## Changes\r\n- Extract some URL-keyed state caching behavior into utility functions\r\n- Refactor PLP to use these utilities\r\n- Implement it in PDP\r\n- Improve PDP propType validation\r\n- Prepopulate PDP with information parsed from PLPs (\"shared state\")\r\n\r\n## How to test-drive this PR\r\n- Visit various PLP and PDPs. \r\n- Go back to previously visited pages.\r\n- Notice that they load almost instantaneously, due to their data already being in the cache!\r\n","created_at":"2016-11-22T01:20:59Z","updated_at":"2016-11-25T19:42:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24da47949e53f4adb0a4463c4594b73c92dd60a8","assignee":{"login":"fractaltheory","id":1211726,"avatar_url":"https://avatars.githubusercontent.com/u/1211726?v=3","gravatar_id":"","url":"https://api.github.com/users/fractaltheory","html_url":"https://github.com/fractaltheory","followers_url":"https://api.github.com/users/fractaltheory/followers","following_url":"https://api.github.com/users/fractaltheory/following{/other_user}","gists_url":"https://api.github.com/users/fractaltheory/gists{/gist_id}","starred_url":"https://api.github.com/users/fractaltheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractaltheory/subscriptions","organizations_url":"https://api.github.com/users/fractaltheory/orgs","repos_url":"https://api.github.com/users/fractaltheory/repos","events_url":"https://api.github.com/users/fractaltheory/events{/privacy}","received_events_url":"https://api.github.com/users/fractaltheory/received_events","type":"User","site_admin":false},"assignees":[{"login":"fractaltheory","id":1211726,"avatar_url":"https://avatars.githubusercontent.com/u/1211726?v=3","gravatar_id":"","url":"https://api.github.com/users/fractaltheory","html_url":"https://github.com/fractaltheory","followers_url":"https://api.github.com/users/fractaltheory/followers","following_url":"https://api.github.com/users/fractaltheory/following{/other_user}","gists_url":"https://api.github.com/users/fractaltheory/gists{/gist_id}","starred_url":"https://api.github.com/users/fractaltheory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fractaltheory/subscriptions","organizations_url":"https://api.github.com/users/fractaltheory/orgs","repos_url":"https://api.github.com/users/fractaltheory/repos","events_url":"https://api.github.com/users/fractaltheory/events{/privacy}","received_events_url":"https://api.github.com/users/fractaltheory/received_events","type":"User","site_admin":false},{"login":"guisers","id":8797909,"avatar_url":"https://avatars.githubusercontent.com/u/8797909?v=3","gravatar_id":"","url":"https://api.github.com/users/guisers","html_url":"https://github.com/guisers","followers_url":"https://api.github.com/users/guisers/followers","following_url":"https://api.github.com/users/guisers/following{/other_user}","gists_url":"https://api.github.com/users/guisers/gists{/gist_id}","starred_url":"https://api.github.com/users/guisers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guisers/subscriptions","organizations_url":"https://api.github.com/users/guisers/orgs","repos_url":"https://api.github.com/users/guisers/repos","events_url":"https://api.github.com/users/guisers/events{/privacy}","received_events_url":"https://api.github.com/users/guisers/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174/commits","review_comments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174/comments","review_comment_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/174/comments","statuses_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/statuses/d46cb0ad01d3995e73975e195e9f4e942067a953","head":{"label":"mobify:url-keyed-state","ref":"url-keyed-state","sha":"d46cb0ad01d3995e73975e195e9f4e942067a953","user":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"repo":{"id":62259838,"name":"progressive-web-scaffold","full_name":"mobify/progressive-web-scaffold","owner":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mobify/progressive-web-scaffold","description":"The scaffold / starter kit for Progressive Web","fork":false,"url":"https://api.github.com/repos/mobify/progressive-web-scaffold","forks_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/forks","keys_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/teams","hooks_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/hooks","issue_events_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/events{/number}","events_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/events","assignees_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/assignees{/user}","branches_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/branches{/branch}","tags_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/tags","blobs_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/refs{/sha}","trees_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/statuses/{sha}","languages_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/languages","stargazers_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/stargazers","contributors_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/contributors","subscribers_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/subscribers","subscription_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/subscription","commits_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/commits{/sha}","git_commits_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/commits{/sha}","comments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/comments{/number}","issue_comment_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/comments{/number}","contents_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/contents/{+path}","compare_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/merges","archive_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/downloads","issues_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues{/number}","pulls_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls{/number}","milestones_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/milestones{/number}","notifications_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/labels{/name}","releases_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/releases{/id}","deployments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/deployments","created_at":"2016-06-29T21:42:48Z","updated_at":"2016-11-04T23:01:15Z","pushed_at":"2016-11-25T19:02:04Z","git_url":"git://github.com/mobify/progressive-web-scaffold.git","ssh_url":"git@github.com:mobify/progressive-web-scaffold.git","clone_url":"https://github.com/mobify/progressive-web-scaffold.git","svn_url":"https://github.com/mobify/progressive-web-scaffold","homepage":null,"size":2607,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":0,"default_branch":"develop"}},"base":{"label":"mobify:develop","ref":"develop","sha":"bb997ad7c2311bb81b0907b9f91ca49243fe3bfe","user":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"repo":{"id":62259838,"name":"progressive-web-scaffold","full_name":"mobify/progressive-web-scaffold","owner":{"login":"mobify","id":73539,"avatar_url":"https://avatars.githubusercontent.com/u/73539?v=3","gravatar_id":"","url":"https://api.github.com/users/mobify","html_url":"https://github.com/mobify","followers_url":"https://api.github.com/users/mobify/followers","following_url":"https://api.github.com/users/mobify/following{/other_user}","gists_url":"https://api.github.com/users/mobify/gists{/gist_id}","starred_url":"https://api.github.com/users/mobify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mobify/subscriptions","organizations_url":"https://api.github.com/users/mobify/orgs","repos_url":"https://api.github.com/users/mobify/repos","events_url":"https://api.github.com/users/mobify/events{/privacy}","received_events_url":"https://api.github.com/users/mobify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mobify/progressive-web-scaffold","description":"The scaffold / starter kit for Progressive Web","fork":false,"url":"https://api.github.com/repos/mobify/progressive-web-scaffold","forks_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/forks","keys_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/teams","hooks_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/hooks","issue_events_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/events{/number}","events_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/events","assignees_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/assignees{/user}","branches_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/branches{/branch}","tags_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/tags","blobs_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/refs{/sha}","trees_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/statuses/{sha}","languages_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/languages","stargazers_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/stargazers","contributors_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/contributors","subscribers_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/subscribers","subscription_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/subscription","commits_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/commits{/sha}","git_commits_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/git/commits{/sha}","comments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/comments{/number}","issue_comment_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/comments{/number}","contents_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/contents/{+path}","compare_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/merges","archive_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/downloads","issues_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues{/number}","pulls_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls{/number}","milestones_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/milestones{/number}","notifications_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/labels{/name}","releases_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/releases{/id}","deployments_url":"https://api.github.com/repos/mobify/progressive-web-scaffold/deployments","created_at":"2016-06-29T21:42:48Z","updated_at":"2016-11-04T23:01:15Z","pushed_at":"2016-11-25T19:02:04Z","git_url":"git://github.com/mobify/progressive-web-scaffold.git","ssh_url":"git@github.com:mobify/progressive-web-scaffold.git","clone_url":"https://github.com/mobify/progressive-web-scaffold.git","svn_url":"https://github.com/mobify/progressive-web-scaffold","homepage":null,"size":2607,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174"},"html":{"href":"https://github.com/mobify/progressive-web-scaffold/pull/174"},"issue":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/174"},"comments":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/issues/174/comments"},"review_comments":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174/comments"},"review_comment":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/pulls/174/commits"},"statuses":{"href":"https://api.github.com/repos/mobify/progressive-web-scaffold/statuses/d46cb0ad01d3995e73975e195e9f4e942067a953"}}}}
{"actor":{"display_login":"fractaltheory"}}