{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/relay/issues/1687","repository_url":"https://api.github.com/repos/facebook/relay","labels_url":"https://api.github.com/repos/facebook/relay/issues/1687/labels{/name}","comments_url":"https://api.github.com/repos/facebook/relay/issues/1687/comments","events_url":"https://api.github.com/repos/facebook/relay/issues/1687/events","html_url":"https://github.com/facebook/relay/issues/1687","id":223963549,"number":1687,"title":"[Modern] \"Dumb\" QueryRenderer equivalent","user":{"login":"taion","id":3112159,"avatar_url":"https://avatars3.githubusercontent.com/u/3112159?v=3","gravatar_id":"","url":"https://api.github.com/users/taion","html_url":"https://github.com/taion","followers_url":"https://api.github.com/users/taion/followers","following_url":"https://api.github.com/users/taion/following{/other_user}","gists_url":"https://api.github.com/users/taion/gists{/gist_id}","starred_url":"https://api.github.com/users/taion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taion/subscriptions","organizations_url":"https://api.github.com/users/taion/orgs","repos_url":"https://api.github.com/users/taion/repos","events_url":"https://api.github.com/users/taion/events{/privacy}","received_events_url":"https://api.github.com/users/taion/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-04-24T21:58:47Z","updated_at":"2017-04-25T00:12:44Z","closed_at":null,"body":"I'm looking to build an equivalent to react-router-relay or Found Relay for use with Relay Modern, to handle fetching multiple \"root\" queries in parallel, despite those queries corresponding to nested routes and corresponding components.\r\n\r\nI don't think the approach I've taken for either library quite works here. They're respectively:\r\n- Aggregate a bunch of queries configs into a single query config, but Relay Modern doesn't have query configs\r\n- Use `primeCache`, but Relay Modern doesn't do caching in all cases\r\n\r\nThe approach I plan to explore is pull out the logic up to `environment.streamQuery` and `environment.subscribe` in `<QueryRenderer>` into a separate function, and just hand off the snapshot to something like a \"dumb query renderer\". This seems analogous to the divide between `<Relay.Renderer>` and `<Relay.ReadyStateRenderer>` in Relay Classic.\r\n\r\nThe next-best option I could think of was to render a bunch of `<QueryRenderer>`s in parallel at the root level, then portal through the data via `context` or something, but that seemed pretty gross. Also, pulling the initial snapshot logic out of React components makes for a nicer server rendering API.\r\n\r\nGiven that, does the approach I've outlined above sound reasonable? If so, would it make sense for this \"dumb query renderer\" to live in Relay core? I believe it'd be something that could be factored out of the current `<QueryRenderer>`, and that equivalent split between `<Relay.Renderer>` and `<Relay.ReadyStateRenderer>` did exist in Relay Classic."},"comment":{"url":"https://api.github.com/repos/facebook/relay/issues/comments/296855748","html_url":"https://github.com/facebook/relay/issues/1687#issuecomment-296855748","issue_url":"https://api.github.com/repos/facebook/relay/issues/1687","id":296855748,"user":{"login":"josephsavona","id":6425824,"avatar_url":"https://avatars3.githubusercontent.com/u/6425824?v=3","gravatar_id":"","url":"https://api.github.com/users/josephsavona","html_url":"https://github.com/josephsavona","followers_url":"https://api.github.com/users/josephsavona/followers","following_url":"https://api.github.com/users/josephsavona/following{/other_user}","gists_url":"https://api.github.com/users/josephsavona/gists{/gist_id}","starred_url":"https://api.github.com/users/josephsavona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josephsavona/subscriptions","organizations_url":"https://api.github.com/users/josephsavona/orgs","repos_url":"https://api.github.com/users/josephsavona/repos","events_url":"https://api.github.com/users/josephsavona/events{/privacy}","received_events_url":"https://api.github.com/users/josephsavona/received_events","type":"User","site_admin":false},"created_at":"2017-04-25T00:12:44Z","updated_at":"2017-04-25T00:12:44Z","body":"@robrichard Hmm that looks like it should work. I would check with `componentWillReceiveProps()` or some other lifecycle hook is perhaps getting executed and wiping out the subscription? Also, `lookup(selector)` will always return a snapshot for which the `data` property is non-null so your conditional may not be entering the right branch. `lookup()` returns whatever happens to be in the store; the fact that it returns a non-null result doesn't mean that exact query has been fetched before. The strategy @taion described is probably more robust: explicitly fetch the data, call lookup() and then pass a snapshot."}}
{"actor":{"display_login":"josephsavona"}}