-
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
ssr: on apollo error, error not passed to component (v2 and v3) #6612
Comments
@benjamn can your team please look at this? |
@benjamn @hwillson are we going to fix this or push people to urql or update documentation (saying it cant handle ssr errors to client)? Im fine with any outcome, just let me know. "all: Using the all policy is the best way to notify your users of potential issues while still showing as much data as possible from your server. It saves both data and errors so your UI can use them." not true :) |
Here are some relevant findings and repro steps proving that apollo's own two recommended methods for SSR getDataFromTree() vs renderToStringWithData() produce different results because of the lack of error caching #3897 (comment). Seems relevant to this bug report. |
To be honest @samueljun i think apollo team doesn't really care about this bug. We are trying to push it into attention for more then a year, and others combined more then 2 years :) Full reproduction paths. |
Intended outcome:
When having an Apollo Error thrown via GraphQL, the React ssr treewalker should just take the Error and proceed and pass error to the component.
Actual outcome:
When we have one query with an Apollo Error, then the treewalker just throws the Error while treewalking. But this error never reaches the component, while documentation stated it does (saves both data and errors). When i change the errorPolicy to defaults, the errored queries will then also be done client-side, which only puts more load on the server.
For client-side everything works as it should. The errors are passed to error object, data is null.
How to reproduce the issue:
Have one query directly sent an Error on ssr, see my reproduction running at https://codesandbox.io/s/github/maapteh/sandbox-react-apollo-issues-3918
Code is available at maapteh/sandbox-react-apollo-issues-3918
Impact
At the moment we cant move to render more parts to server-side because of this. So we are hacking data to pass the status which is totally not how graphql is meant to be.
this is a continuation for apollographql/react-apollo#3918 where i mentioned also in v3rc not working, but that one is archived now
The text was updated successfully, but these errors were encountered: