{"action":"closed","issue":{"url":"https://api.github.com/repos/ReactTraining/react-router/issues/3846","repository_url":"https://api.github.com/repos/ReactTraining/react-router","labels_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3846/labels{/name}","comments_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3846/comments","events_url":"https://api.github.com/repos/ReactTraining/react-router/issues/3846/events","html_url":"https://github.com/ReactTraining/react-router/issues/3846","id":176881993,"number":3846,"title":"4.0 Use Cases","user":{"login":"AndrewIngram","id":35227,"avatar_url":"https://avatars.githubusercontent.com/u/35227?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewIngram","html_url":"https://github.com/AndrewIngram","followers_url":"https://api.github.com/users/AndrewIngram/followers","following_url":"https://api.github.com/users/AndrewIngram/following{/other_user}","gists_url":"https://api.github.com/users/AndrewIngram/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewIngram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewIngram/subscriptions","organizations_url":"https://api.github.com/users/AndrewIngram/orgs","repos_url":"https://api.github.com/users/AndrewIngram/repos","events_url":"https://api.github.com/users/AndrewIngram/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewIngram/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-09-14T11:24:54Z","updated_at":"2016-09-14T21:04:44Z","closed_at":"2016-09-14T21:04:44Z","body":"The background for this issue is that there are use cases fundamental to real world projects (public websites more so than apps behind an auth check), that I believe aren't supported by the upcoming version 4 of React Router.\r\n\r\nThese use cases aren't exhaustive, but will hopefully get a productive conversation started. Anyone should feel free to add more to the list. I think there are two possible desirable outcomes here:\r\n\r\n1. We find a way to solve these requirements in RR4 (note, I *don't* consider defining my routing behaviour twice to be a solution), they get added to the docs and/or examples.\r\n2. It's concluded that the API can't support every use-case, and the limitations and shortcomings get properly documented (along with the use cases it supports well, obviously :))\r\n\r\n\r\n# Use cases\r\n\r\n## 1. Data-loading\r\n\r\nThis is the most obvious one, so a good one to start with. Previously, when we used routes, it was possible to map a URL to a list of entry point components. If components were able to statically define their data requirements (a fetch operation for some, a GraphQL fragment for Relay users), it was possible to fetch all the data before rendering the components.\r\n\r\nThe new API defines matching behaviour in the render method of the components, which means a child \"route\" can't start loading its data until the parent's render method has been called. Ultimately this means the render process will be staggered and data requests turned into a sequential waterfall. Avoiding this request waterfall is critical to performance.\r\n\r\nIn previous versions, it was possible for Relay users to fire off all data requests in parallel, or even batch everything up into a single request. This was only possible thanks to being able to statically work out all the data dependencies up front.\r\n\r\nNote: I'm not ignoring the value of being able to defer some data dependencies and showing loading messages instead, but I think we'd be going down a tangent if we dwelled on it.\r\n\r\n## 2. Sitemaps, robots and apple-app-site-association files\r\n\r\nThis is a bundling of a few different requirements that are all basically the same.\r\n\r\nBasically, this use case is about the need to have hosted files that explain the structure of the site. At small scales these files can be hard-coded. At larger scales it needs to be possible to generate them (and generate them efficiently). With top-down route definitions, this is relatively easy."}}
{"actor":{"display_login":"mjackson"}}