-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useSuspenseQuery returns an error instead of throwing an exception #11800
Comments
Thanks so much 🙂 |
Hey @tarasmatsyk 👋 I wanted to provide a gentle nudge and see if you are able to provide a reproduction of the issue. We've got this hook tested pretty thoroughly in regards to errors, so either we missed an edge case or something else is at play here. A CodeSandbox or Replay of the issue would be great. If you'd like to go the CodeSandbox route, we have template use can use as a starting point. Thanks! |
@jerelmiller thanks for a follow-up, but I still don't understand how to catch the difference. I can confirm the issue is still present at 3.10.4, react 18.3, react-dom 18.3. Could the apollo client expect network error as my server returns a 200 OK response with an error? I doubt the issue is in the useSuspenseQuery file, it's either caching or some other place. I get an error in the |
@tarasmatsyk I'm really sorry to sound like a broken record, but its extremely difficult for me to understand what might be happening without a reproduction. I don't doubt this is happening to you, but I don't even know where to begin since I don't know what condition causes it to return an error instead of throw. If you're able to provide me with a reproduction, I'd be happy to dig in further.
This shouldn't be it since a 200 response is pretty standard GraphQL behavior with errors. The error format you provided in your server response also looks fine.
Could you expand on this? We don't have a Let me note too that I don't expect a reproduction in the form of writing a test case in our own |
@jerelmiller I get it, I barely can get any reproduction steps, your suggestions def help. I was referring to this
Let me try to reproduce the issue on a small app. |
@jerelmiller I think I misled you with the original report, I had a hook a few components above with I am doing more investigation to see how this mess works together :) (not the apollo one :D ) PS. Once I removed the hook above, it all started working |
Issue Description
I am using a suspense query and an error boundary to catch all unhandled errors. An example of usage:
everything works fine in 3.8.x, after update to 3.9.0+ suspense no longer throws an error and behaves more like
useQuery
hook without aloading
propertyan example of error
perhaps react-dom is involved somehow, I have a limited understanding of what happens here and cannot reproduce the issue if I pass my GQL response into unit tests apollo-client has (or I am bad at it)
server response example
Unfortunately, I don't have more details at the moment. I am leaving this issue in case someone else faces similar behavior and I am able to get a reproducible sample
Link to Reproduction
N/A
Reproduction Steps
also discussed here:
#11664
@apollo/client
version3.9.0
The text was updated successfully, but these errors were encountered: