Open janicduplessis opened 2 years ago
The fetch functions never threw an exception. Not sure fetch throws errors, only if dns or unlikely network stuff.
Can you link a more concrete example, and repro steps?
The relay fetch function can throw, either with a network error (via fetch throwing) or if the api returns an error (https://github.com/janicduplessis/relay-examples/blob/partial-render-error-repro/issue-tracker/src/RelayEnvironment.js#L53). In the example repo I linked I simulate a network error for the IssueDetailRootQuery
.
Here's the full repro steps:
git clone https://github.com/janicduplessis/relay-examples.git
cd relay-examples
git checkout partial-render-error-repro
cd issue-tracker
yarn install
yarn start
@captbaritone Sorry for the direct ping, but was wondering if you or someone at meta could have a look at this issue. More specifically how do you handle errors when using partial rendering as currently it seems to still render with missing data instead of having the fragment throw an error. I think my repro demonstrates the problem pretty well. I've been using the patch mentioned in the issue for a while and can commit some time to upstream it if it makes sense.
When a query renders with partial data, but the network request fails the suspended fragments resolve with missing data instead of throwing the error.
Here's an example repro of the issue with the issue tracker example: https://github.com/janicduplessis/relay-examples/tree/partial-render-error-repro
To test, follow the instructions in the issue-tracker folder, then when the app is started click on one of the issue to open the issue details and see the error
TypeError: undefined is not an object (evaluating 'data.comments.edges')
.I investigated the cause and managed to patch the issue with this, if this seems like a good solution I can open a PR with the fix.