{"action":"created","comment":{"url":"https://api.github.com/repos/zeit/next.js/pulls/comments/186862254","pull_request_review_id":118527192,"id":186862254,"diff_hunk":"@@ -0,0 +1,49 @@\n+import App, {Container} from 'next/app'\n+import {Provider} from 'react-redux'\n+import {initializeStore} from '../store'\n+\n+const isServer = typeof window === 'undefined'\n+const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__'\n+\n+function getOrCreateStore(initialState) {\n+  // Always make a new store if server, otherwise state is shared between requests\n+  if (isServer) {\n+    return initializeStore(initialState)\n+  }\n+\n+  // Store in global variable if client\n+  if (!window[__NEXT_REDUX_STORE__]) {\n+    window[__NEXT_REDUX_STORE__] = initializeStore(initialState)\n+  }\n+  return window[__NEXT_REDUX_STORE__]\n+}\n+\n+export default (App) => {\n+  return class Redux extends React.Component {\n+    static async getInitialProps (appContext) {\n+      const reduxStore = getOrCreateStore()\n+    \n+      // Provide the store to getInitialProps of pages\n+      appContext.ctx.reduxStore = reduxStore\n+\n+      let appProps = {}\n+      if (App.getInitialProps) {\n+        appProps = await App.getInitialProps(appContext)\n+      }\n+\n+      return {\n+        ...appProps,\n+        initialReduxState: reduxStore.getState()\n+      }\n+    }\n+\n+    constructor(props) {\n+      super(props)\n+      this.reduxStore = getOrCreateStore(props.initialReduxState)","path":"examples/with-redux/lib/with-redux-store.js","position":42,"original_position":42,"commit_id":"3a129696a724a4cdfbf17b5dc1093fffb964447f","original_commit_id":"3a129696a724a4cdfbf17b5dc1093fffb964447f","user":{"login":"kirill-konshin","id":1530410,"avatar_url":"https://avatars0.githubusercontent.com/u/1530410?v=4","gravatar_id":"","url":"https://api.github.com/users/kirill-konshin","html_url":"https://github.com/kirill-konshin","followers_url":"https://api.github.com/users/kirill-konshin/followers","following_url":"https://api.github.com/users/kirill-konshin/following{/other_user}","gists_url":"https://api.github.com/users/kirill-konshin/gists{/gist_id}","starred_url":"https://api.github.com/users/kirill-konshin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirill-konshin/subscriptions","organizations_url":"https://api.github.com/users/kirill-konshin/orgs","repos_url":"https://api.github.com/users/kirill-konshin/repos","events_url":"https://api.github.com/users/kirill-konshin/events{/privacy}","received_events_url":"https://api.github.com/users/kirill-konshin/received_events","type":"User","site_admin":false},"body":"For the server to client case yes, but from what I see on server it's not true. When rendered on server you will get the live object.","created_at":"2018-05-08T20:47:04Z","updated_at":"2018-05-08T20:47:04Z","html_url":"https://github.com/zeit/next.js/pull/4295#discussion_r186862254","pull_request_url":"https://api.github.com/repos/zeit/next.js/pulls/4295","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/zeit/next.js/pulls/comments/186862254"},"html":{"href":"https://github.com/zeit/next.js/pull/4295#discussion_r186862254"},"pull_request":{"href":"https://api.github.com/repos/zeit/next.js/pulls/4295"}},"in_reply_to_id":186853425},"pull_request":{"url":"https://api.github.com/repos/zeit/next.js/pulls/4295","id":186337542,"html_url":"https://github.com/zeit/next.js/pull/4295","diff_url":"https://github.com/zeit/next.js/pull/4295.diff","patch_url":"https://github.com/zeit/next.js/pull/4295.patch","issue_url":"https://api.github.com/repos/zeit/next.js/issues/4295","number":4295,"state":"closed","locked":false,"title":"Implement with-redux using _app.js","user":{"login":"timneutkens","id":6324199,"avatar_url":"https://avatars2.githubusercontent.com/u/6324199?v=4","gravatar_id":"","url":"https://api.github.com/users/timneutkens","html_url":"https://github.com/timneutkens","followers_url":"https://api.github.com/users/timneutkens/followers","following_url":"https://api.github.com/users/timneutkens/following{/other_user}","gists_url":"https://api.github.com/users/timneutkens/gists{/gist_id}","starred_url":"https://api.github.com/users/timneutkens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timneutkens/subscriptions","organizations_url":"https://api.github.com/users/timneutkens/orgs","repos_url":"https://api.github.com/users/timneutkens/repos","events_url":"https://api.github.com/users/timneutkens/events{/privacy}","received_events_url":"https://api.github.com/users/timneutkens/received_events","type":"User","site_admin":false},"body":"Simplifies the example a lot :+1:","created_at":"2018-05-07T12:29:56Z","updated_at":"2018-05-08T20:47:04Z","closed_at":"2018-05-07T13:03:55Z","merged_at":"2018-05-07T13:03:55Z","merge_commit_sha":"0697c289f8ab84ca3fc753106a4dfba681cd47a8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zeit/next.js/pulls/4295/commits","review_comments_url":"https://api.github.com/repos/zeit/next.js/pulls/4295/comments","review_comment_url":"https://api.github.com/repos/zeit/next.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zeit/next.js/issues/4295/comments","statuses_url":"https://api.github.com/repos/zeit/next.js/statuses/3a129696a724a4cdfbf17b5dc1093fffb964447f","head":{"label":"timneutkens:add/app-redux","ref":"add/app-redux","sha":"3a129696a724a4cdfbf17b5dc1093fffb964447f","user":{"login":"timneutkens","id":6324199,"avatar_url":"https://avatars2.githubusercontent.com/u/6324199?v=4","gravatar_id":"","url":"https://api.github.com/users/timneutkens","html_url":"https://github.com/timneutkens","followers_url":"https://api.github.com/users/timneutkens/followers","following_url":"https://api.github.com/users/timneutkens/following{/other_user}","gists_url":"https://api.github.com/users/timneutkens/gists{/gist_id}","starred_url":"https://api.github.com/users/timneutkens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timneutkens/subscriptions","organizations_url":"https://api.github.com/users/timneutkens/orgs","repos_url":"https://api.github.com/users/timneutkens/repos","events_url":"https://api.github.com/users/timneutkens/events{/privacy}","received_events_url":"https://api.github.com/users/timneutkens/received_events","type":"User","site_admin":false},"repo":{"id":77590473,"name":"next.js","full_name":"timneutkens/next.js","owner":{"login":"timneutkens","id":6324199,"avatar_url":"https://avatars2.githubusercontent.com/u/6324199?v=4","gravatar_id":"","url":"https://api.github.com/users/timneutkens","html_url":"https://github.com/timneutkens","followers_url":"https://api.github.com/users/timneutkens/followers","following_url":"https://api.github.com/users/timneutkens/following{/other_user}","gists_url":"https://api.github.com/users/timneutkens/gists{/gist_id}","starred_url":"https://api.github.com/users/timneutkens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timneutkens/subscriptions","organizations_url":"https://api.github.com/users/timneutkens/orgs","repos_url":"https://api.github.com/users/timneutkens/repos","events_url":"https://api.github.com/users/timneutkens/events{/privacy}","received_events_url":"https://api.github.com/users/timneutkens/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/timneutkens/next.js","description":"A minimalistic framework for universal server-rendered React applications","fork":true,"url":"https://api.github.com/repos/timneutkens/next.js","forks_url":"https://api.github.com/repos/timneutkens/next.js/forks","keys_url":"https://api.github.com/repos/timneutkens/next.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timneutkens/next.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timneutkens/next.js/teams","hooks_url":"https://api.github.com/repos/timneutkens/next.js/hooks","issue_events_url":"https://api.github.com/repos/timneutkens/next.js/issues/events{/number}","events_url":"https://api.github.com/repos/timneutkens/next.js/events","assignees_url":"https://api.github.com/repos/timneutkens/next.js/assignees{/user}","branches_url":"https://api.github.com/repos/timneutkens/next.js/branches{/branch}","tags_url":"https://api.github.com/repos/timneutkens/next.js/tags","blobs_url":"https://api.github.com/repos/timneutkens/next.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timneutkens/next.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timneutkens/next.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/timneutkens/next.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timneutkens/next.js/statuses/{sha}","languages_url":"https://api.github.com/repos/timneutkens/next.js/languages","stargazers_url":"https://api.github.com/repos/timneutkens/next.js/stargazers","contributors_url":"https://api.github.com/repos/timneutkens/next.js/contributors","subscribers_url":"https://api.github.com/repos/timneutkens/next.js/subscribers","subscription_url":"https://api.github.com/repos/timneutkens/next.js/subscription","commits_url":"https://api.github.com/repos/timneutkens/next.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/timneutkens/next.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/timneutkens/next.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/timneutkens/next.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/timneutkens/next.js/contents/{+path}","compare_url":"https://api.github.com/repos/timneutkens/next.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timneutkens/next.js/merges","archive_url":"https://api.github.com/repos/timneutkens/next.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timneutkens/next.js/downloads","issues_url":"https://api.github.com/repos/timneutkens/next.js/issues{/number}","pulls_url":"https://api.github.com/repos/timneutkens/next.js/pulls{/number}","milestones_url":"https://api.github.com/repos/timneutkens/next.js/milestones{/number}","notifications_url":"https://api.github.com/repos/timneutkens/next.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timneutkens/next.js/labels{/name}","releases_url":"https://api.github.com/repos/timneutkens/next.js/releases{/id}","deployments_url":"https://api.github.com/repos/timneutkens/next.js/deployments","created_at":"2016-12-29T06:55:52Z","updated_at":"2018-03-12T17:59:36Z","pushed_at":"2018-05-08T15:35:06Z","git_url":"git://github.com/timneutkens/next.js.git","ssh_url":"git@github.com:timneutkens/next.js.git","clone_url":"https://github.com/timneutkens/next.js.git","svn_url":"https://github.com/timneutkens/next.js","homepage":"https://zeit.co/blog/next","size":5490,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"zeit:canary","ref":"canary","sha":"4881cd346b8155314c02a6996538fb48d324111d","user":{"login":"zeit","id":14985020,"avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"repo":{"id":70107786,"name":"next.js","full_name":"zeit/next.js","owner":{"login":"zeit","id":14985020,"avatar_url":"https://avatars0.githubusercontent.com/u/14985020?v=4","gravatar_id":"","url":"https://api.github.com/users/zeit","html_url":"https://github.com/zeit","followers_url":"https://api.github.com/users/zeit/followers","following_url":"https://api.github.com/users/zeit/following{/other_user}","gists_url":"https://api.github.com/users/zeit/gists{/gist_id}","starred_url":"https://api.github.com/users/zeit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zeit/subscriptions","organizations_url":"https://api.github.com/users/zeit/orgs","repos_url":"https://api.github.com/users/zeit/repos","events_url":"https://api.github.com/users/zeit/events{/privacy}","received_events_url":"https://api.github.com/users/zeit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zeit/next.js","description":"Framework for server-rendered or statically-exported React apps","fork":false,"url":"https://api.github.com/repos/zeit/next.js","forks_url":"https://api.github.com/repos/zeit/next.js/forks","keys_url":"https://api.github.com/repos/zeit/next.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zeit/next.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zeit/next.js/teams","hooks_url":"https://api.github.com/repos/zeit/next.js/hooks","issue_events_url":"https://api.github.com/repos/zeit/next.js/issues/events{/number}","events_url":"https://api.github.com/repos/zeit/next.js/events","assignees_url":"https://api.github.com/repos/zeit/next.js/assignees{/user}","branches_url":"https://api.github.com/repos/zeit/next.js/branches{/branch}","tags_url":"https://api.github.com/repos/zeit/next.js/tags","blobs_url":"https://api.github.com/repos/zeit/next.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zeit/next.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zeit/next.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/zeit/next.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zeit/next.js/statuses/{sha}","languages_url":"https://api.github.com/repos/zeit/next.js/languages","stargazers_url":"https://api.github.com/repos/zeit/next.js/stargazers","contributors_url":"https://api.github.com/repos/zeit/next.js/contributors","subscribers_url":"https://api.github.com/repos/zeit/next.js/subscribers","subscription_url":"https://api.github.com/repos/zeit/next.js/subscription","commits_url":"https://api.github.com/repos/zeit/next.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/zeit/next.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/zeit/next.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/zeit/next.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/zeit/next.js/contents/{+path}","compare_url":"https://api.github.com/repos/zeit/next.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zeit/next.js/merges","archive_url":"https://api.github.com/repos/zeit/next.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zeit/next.js/downloads","issues_url":"https://api.github.com/repos/zeit/next.js/issues{/number}","pulls_url":"https://api.github.com/repos/zeit/next.js/pulls{/number}","milestones_url":"https://api.github.com/repos/zeit/next.js/milestones{/number}","notifications_url":"https://api.github.com/repos/zeit/next.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zeit/next.js/labels{/name}","releases_url":"https://api.github.com/repos/zeit/next.js/releases{/id}","deployments_url":"https://api.github.com/repos/zeit/next.js/deployments","created_at":"2016-10-05T23:32:51Z","updated_at":"2018-05-08T20:27:22Z","pushed_at":"2018-05-08T19:44:26Z","git_url":"git://github.com/zeit/next.js.git","ssh_url":"git@github.com:zeit/next.js.git","clone_url":"https://github.com/zeit/next.js.git","svn_url":"https://github.com/zeit/next.js","homepage":"https://nextjs.org","size":5927,"stargazers_count":25030,"watchers_count":25030,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2374,"mirror_url":null,"archived":false,"open_issues_count":249,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2374,"open_issues":249,"watchers":25030,"default_branch":"canary"}},"_links":{"self":{"href":"https://api.github.com/repos/zeit/next.js/pulls/4295"},"html":{"href":"https://github.com/zeit/next.js/pull/4295"},"issue":{"href":"https://api.github.com/repos/zeit/next.js/issues/4295"},"comments":{"href":"https://api.github.com/repos/zeit/next.js/issues/4295/comments"},"review_comments":{"href":"https://api.github.com/repos/zeit/next.js/pulls/4295/comments"},"review_comment":{"href":"https://api.github.com/repos/zeit/next.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zeit/next.js/pulls/4295/commits"},"statuses":{"href":"https://api.github.com/repos/zeit/next.js/statuses/3a129696a724a4cdfbf17b5dc1093fffb964447f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"kirill-konshin"}}