{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/615","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/615/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/615/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/615/events","html_url":"https://github.com/apollographql/react-apollo/issues/615","id":220604280,"number":615,"title":"getDataFromTree throws errors when any query fails","user":{"login":"choonkending","id":3787885,"avatar_url":"https://avatars0.githubusercontent.com/u/3787885?v=4","gravatar_id":"","url":"https://api.github.com/users/choonkending","html_url":"https://github.com/choonkending","followers_url":"https://api.github.com/users/choonkending/followers","following_url":"https://api.github.com/users/choonkending/following{/other_user}","gists_url":"https://api.github.com/users/choonkending/gists{/gist_id}","starred_url":"https://api.github.com/users/choonkending/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choonkending/subscriptions","organizations_url":"https://api.github.com/users/choonkending/orgs","repos_url":"https://api.github.com/users/choonkending/repos","events_url":"https://api.github.com/users/choonkending/events{/privacy}","received_events_url":"https://api.github.com/users/choonkending/received_events","type":"User","site_admin":false},"labels":[{"id":659600461,"url":"https://api.github.com/repos/apollographql/react-apollo/labels/no-recent-activity","name":"no-recent-activity","color":"ffffff","default":false}],"state":"closed","locked":false,"assignee":{"login":"jbaxleyiii","id":4967600,"avatar_url":"https://avatars2.githubusercontent.com/u/4967600?v=4","gravatar_id":"","url":"https://api.github.com/users/jbaxleyiii","html_url":"https://github.com/jbaxleyiii","followers_url":"https://api.github.com/users/jbaxleyiii/followers","following_url":"https://api.github.com/users/jbaxleyiii/following{/other_user}","gists_url":"https://api.github.com/users/jbaxleyiii/gists{/gist_id}","starred_url":"https://api.github.com/users/jbaxleyiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbaxleyiii/subscriptions","organizations_url":"https://api.github.com/users/jbaxleyiii/orgs","repos_url":"https://api.github.com/users/jbaxleyiii/repos","events_url":"https://api.github.com/users/jbaxleyiii/events{/privacy}","received_events_url":"https://api.github.com/users/jbaxleyiii/received_events","type":"User","site_admin":false},"assignees":[{"login":"jbaxleyiii","id":4967600,"avatar_url":"https://avatars2.githubusercontent.com/u/4967600?v=4","gravatar_id":"","url":"https://api.github.com/users/jbaxleyiii","html_url":"https://github.com/jbaxleyiii","followers_url":"https://api.github.com/users/jbaxleyiii/followers","following_url":"https://api.github.com/users/jbaxleyiii/following{/other_user}","gists_url":"https://api.github.com/users/jbaxleyiii/gists{/gist_id}","starred_url":"https://api.github.com/users/jbaxleyiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbaxleyiii/subscriptions","organizations_url":"https://api.github.com/users/jbaxleyiii/orgs","repos_url":"https://api.github.com/users/jbaxleyiii/repos","events_url":"https://api.github.com/users/jbaxleyiii/events{/privacy}","received_events_url":"https://api.github.com/users/jbaxleyiii/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2017-04-10T10:39:41Z","updated_at":"2017-09-26T11:58:18Z","closed_at":"2017-08-24T22:53:02Z","author_association":"NONE","body":"### Background\r\n\r\nI asked a question on StackOverflow today [here](http://stackoverflow.com/questions/43316336/how-should-we-handle-an-error-while-getting-initial-state-from-store-in-getdataf). \r\n\r\nI thunk about it harder afterwards and decided that this is a discussion worthy of a Git issue.\r\n\r\n### Problem\r\n\r\n_*Any*_ error gets thrown in [getDataFromTree](https://github.com/apollographql/react-apollo/blob/fb7065912178c67e35c8c3a765ab69473af67d63/src/server.ts#L141-L148). \r\n\r\n### Expected/Proposed Behaviour\r\n\r\nReturn the data with an `error` Array, without throwing an error.\r\n\r\n***Why?***\r\n\r\nOur GraphQL server speaks to multiple APIs and returns a graphQL response which is handled by Apollo UI.\r\n\r\nCertain GraphQL errors are **not considered critical**, and we want to still render a page with it. E.g.\r\n\r\n```js\r\ndata: {\r\n   thing: {\r\n       id: \"1234\"\r\n       name: \"Thing\"\r\n       nonCriticalData: null\r\n   },\r\n   error: {\r\n       graphQLErrors: [\r\n           path: ['thing', 'nonCriticalData']\r\n       ]\r\n   }\r\n```\r\n\r\nWith the above response we get from apollo, we want to still render a page with `thing`.\r\n\r\nI have followed https://github.com/apollographql/react-apollo/pull/488#issuecomment-284756892 and got to this point.\r\n\r\nIn my mind the errors should be returned and not thrown unless necessary, because not all errors are equal. \r\n\r\nIdeally I would like to do the following\r\n\r\n```js\r\ngetDataFromTree(app)\r\n    .then(() => {\r\n             const content = ReactDOMServer.renderToString(app);\r\n             const { data } = client.getInitialState();   <------ Data (with errors)\r\n             // check for expected errors and render\r\n             return renderPage(data);\r\n     })\r\n    .catch(error => {\r\n         // handle unexpected errors\r\n    });\r\n```\r\n\r\n### Version\r\n- apollo-client@1.0.0-rc2\r\n- react-apollo@1.0.1\r\n\r\nP.S. Thanks for an awesome library. Happy to help out if needed. "},"comment":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/comments/332175712","html_url":"https://github.com/apollographql/react-apollo/issues/615#issuecomment-332175712","issue_url":"https://api.github.com/repos/apollographql/react-apollo/issues/615","id":332175712,"user":{"login":"OllieJennings","id":1575448,"avatar_url":"https://avatars2.githubusercontent.com/u/1575448?v=4","gravatar_id":"","url":"https://api.github.com/users/OllieJennings","html_url":"https://github.com/OllieJennings","followers_url":"https://api.github.com/users/OllieJennings/followers","following_url":"https://api.github.com/users/OllieJennings/following{/other_user}","gists_url":"https://api.github.com/users/OllieJennings/gists{/gist_id}","starred_url":"https://api.github.com/users/OllieJennings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OllieJennings/subscriptions","organizations_url":"https://api.github.com/users/OllieJennings/orgs","repos_url":"https://api.github.com/users/OllieJennings/repos","events_url":"https://api.github.com/users/OllieJennings/events{/privacy}","received_events_url":"https://api.github.com/users/OllieJennings/received_events","type":"User","site_admin":false},"created_at":"2017-09-26T11:58:18Z","updated_at":"2017-09-26T11:58:18Z","author_association":"NONE","body":"@jbaxleyiii any news on this since apollo 2.0 is coming, would be nice to see something like this sorted"}}
{"actor":{"display_login":"OllieJennings"}}