-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolver should not swallow errors from the Relay Network Calls #111
Comments
See facebook/relay#1913. What's the difference with a normal I believe the same error handling behavior holds in |
@taion Why not throw the error by default in found and allow the developer to implement error boundaries? |
I think I understand the idea on render but then how do you run a global I was thinking of the resolve as taking a similar position to a Is this the way its intended to be used or is the intent for each route to act as it's own |
I don't throw the error by default here because I want to match the semantics have having each route act as its own |
Ok, that makes sense. I might try to update the docs to help explain that concept. Thanks for your quick response! |
What docs? \: You might want to add a note to #56. |
Following up with #86 (comment) (just found this issue after posting that comment):
That makes perfect sense. Since |
Oh my bad, I guess that's a network error, and not the |
@dminkovsky Yes. I believe facebook/relay#1913 still stands. Right now I just throw in the network layer. It's not ideal but I don't need partial results quite yet. It's not that |
By "I just throw in the network layer", I mean this is what I do in my applications – not in this library. |
HI I am running into this issue at the moment. Testing for scenarios where network is down (as opposed to errors coming back from the graphql serve). Getting the network error back in the fetchQuery catch section. But is there a way to specify a render state for a network connectivity issue, rather than just not rendering the component? I've tried re-throwing network errors from the catch state but the component still doesn't render. I think this is a different problem from facebook/relay#1913? Is this a seperate issue to this one? |
You maybe able to provide additional details on the error that you throw from there, then use that to control rendering. |
Hi thanks @taion. Any error I throw from the catch at the moment looks like it just logs to the console in the inspector. I can't seem to find where I can return an alternate render for error states. Here is my current setup (with a custom wrapper that populates an access token wrapper in the fetch header): I was expecting to see the error render state returned back as specified in here:... But it doesn't really seem to be executing that renderError block? Is there someplace else I should be looking into? |
If you want to hit the global |
Ahh ok, I think my problem might be before that. |
PS I'd prefer not to hit the global error handler. At the moment I can't render anything on network connectivity issues so I'm trying there, and also my component. For reference my component looks like this: The console log line with Thanks again @taion |
You need render on the route. So like |
Mostly, but don't use |
I added a note. |
The current resolver appears to swallow all of errors coming from the network layer leading to behavior that isn't similar to a standard found router or a relay-modern QueryRenderer. A developer can turn on error handling by explicitly including a render in each route but this seems error prone.
I seems like three possible solutions might make sense:
I think there's some merit in each approach and I'd be happy to take the first crack at implementing any of these and submitting a PR or working on another solution if these don't seem right.
The text was updated successfully, but these errors were encountered: