{"action":"created","issue":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/4093","repository_url":"https://api.github.com/repos/ReactTraining/react-router","labels_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4093/labels{/name}","comments_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4093/comments","events_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4093/events","html_url":"https://github.com/ReactTraining/react-router/issues/4093","id":185128532,"number":4093,"title":"After updating to 3.0.0, server side rendering async routing doesn't work.","user":{"login":"ZeroCho","id":10962668,"avatar_url":"https://avatars.githubusercontent.com/u/10962668?v=3","gravatar_id":"","url":"https://api.github.com/users/ZeroCho","html_url":"https://github.com/ZeroCho","followers_url":"https://api.github.com/users/ZeroCho/followers","following_url":"https://api.github.com/users/ZeroCho/following{/other_user}","gists_url":"https://api.github.com/users/ZeroCho/gists{/gist_id}","starred_url":"https://api.github.com/users/ZeroCho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZeroCho/subscriptions","organizations_url":"https://api.github.com/users/ZeroCho/orgs","repos_url":"https://api.github.com/users/ZeroCho/repos","events_url":"https://api.github.com/users/ZeroCho/events{/privacy}","received_events_url":"https://api.github.com/users/ZeroCho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-25T14:08:29Z","updated_at":"2016-10-25T15:54:21Z","closed_at":null,"body":"<!-- BUG TEMPLATE -->\r\n### Version\r\n3.0.0\r\n\r\nI am using server side rendering with async routing, following below instruction.\r\n[https://github.com/ReactTraining/react-router/blob/master/docs/guides/ServerRendering.md#async-routes](Link)\r\n\r\nIt used to work in 2.8.1 but after updating to 3.0.0, async routing doesn't work and there happens the error message.\r\n\r\n`cannot read property pathname of undefined` at [https://github.com/ReactTraining/react-router/blob/master/modules/matchRoutes.js#L226](here)\r\n\r\nI guess in 3.0.0 something changed about handling **location** in the client\r\n\r\n### client side code\r\n```\r\nmatch({ history, routes: createRoutes(store) }, (error, redirect, props) => {\r\n  function logPageView() {\r\n    ga.initialize('UA-53706909-4');\r\n    ga.set({ page: window.location.pathname });\r\n    ga.pageview(window.location.pathname);\r\n    if (window.__INITIAL_STATE__ !== null) {\r\n      window.__INITIAL_STATE__ = null;\r\n      return;\r\n    }\r\n    preRenderMiddleware(store.dispatch, this.state);\r\n  }\r\n  render(\r\n    <Provider store={store} key=\"provider\">\r\n      <Router {...props} onUpdate={logPageView} />\r\n    </Provider>,\r\n    document.getElementById('app-root')\r\n  );\r\n});\r\n```\r\n### server side code\r\n```\r\nmatch({ routes, location: req.url }, (err, redirect, props) => {\r\n    if (err) {\r\n      console.error('MatchError:', err);\r\n      res.status(500).json(err);\r\n    } else if (redirect) {\r\n      res.redirect(302, redirect.pathname + redirect.search);\r\n    } else if (props) {\r\n      preRenderMiddleware(store.dispatch, props)\r\n        .then(() => {\r\n          const initialState = store.getState();\r\n          const componentHTML = (\r\n            <Provider store={store} key=\"provider\">\r\n              <RouterContext {...props} />\r\n            </Provider>\r\n          );\r\n          const header = makeHeader(props.routes, initialState, props.params);\r\n          const finalHTML = `<!DOCTYPE html>${renderToString(\r\n            <Layout header={header} content={componentHTML} initialState={initialState} />\r\n          )}`;\r\n          res.status(200).send(finalHTML);\r\n        })\r\n        .catch((renderError) => {\r\n          console.error('renderError', renderError);\r\n          res.status(500).json(renderError);\r\n        });\r\n    } else {\r\n      res.status(404).send('요청하신 페이지가 없습니다. 메인 페이지로 돌아가서 확인해보세요');\r\n    }\r\n  });\r\n```"},"comment":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/comments/256077240","html_url":"https://github.com/ReactTraining/react-router/issues/4093#issuecomment-256077240","issue_url":"https://api.github.com/repos/ReactTraining/react-router/issues/4093","id":256077240,"user":{"login":"timdorr","id":17882,"avatar_url":"https://avatars.githubusercontent.com/u/17882?v=3","gravatar_id":"","url":"https://api.github.com/users/timdorr","html_url":"https://github.com/timdorr","followers_url":"https://api.github.com/users/timdorr/followers","following_url":"https://api.github.com/users/timdorr/following{/other_user}","gists_url":"https://api.github.com/users/timdorr/gists{/gist_id}","starred_url":"https://api.github.com/users/timdorr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timdorr/subscriptions","organizations_url":"https://api.github.com/users/timdorr/orgs","repos_url":"https://api.github.com/users/timdorr/repos","events_url":"https://api.github.com/users/timdorr/events{/privacy}","received_events_url":"https://api.github.com/users/timdorr/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T15:54:21Z","updated_at":"2016-10-25T15:54:21Z","body":"Are you using react-router-redux? It is currently not compatible with router or history 3.0: https://github.com/reactjs/react-router-redux/issues/475"}}
{"actor":{"display_login":"timdorr"}}