Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Option to bail SSR (or not) on query error #1046

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

Open
brunomperes opened this issue Aug 19, 2020 · 2 comments
Open

Option to bail SSR (or not) on query error #1046

brunomperes opened this issue Aug 19, 2020 · 2 comments

Comments

@brunomperes
Copy link

brunomperes commented Aug 19, 2020

Is your feature request related to a problem? Please describe.
After #901 SSR bails out when any vue-apollo query fails.

However one could alternatively still want to still have the page rendered even if one of the requests failed. If it's some network issue, the query can automatically retry in the client.

With direct access to serverPrefetch one had the option of doing that by resolving the Promise if it fails and handling the error, but that's not possible with component queries.

Describe the solution you'd like
An option on global level and/or on request level to decide whether that particular call is allowed to fail. For example:

const apolloProvider = new VueApollo({
  defaultProvider: apolloClient,
  rejectSsrOnQueryError: false // or any better name
})

Or in smart query level:

<script>
import gql from "graphql-tag";

export default {
  apollo: {
    hello: {
      query: gql`
        query PingMessage($message: String!) {
          ping(message: $message)
        }
      `,
      rejectSsrOnError: false,
    },
  },
};
</script>

Describe alternatives you've considered
Naming it bailRenderingOnError.

@brunomperes brunomperes changed the title Option to bail SSR on request error Option to bail SSR (or not) on query error Aug 19, 2020
@d3x7r0
Copy link

d3x7r0 commented Dec 6, 2021

Hi there. We've been bitten by this omission in our app and were wondering if there was any way we could help get it done.

Just to give an idea of what's happening for us: our system is designed in such a way that there are multiple individual modules on a single page that have individual queries. The modules are meant to handle their own errors and show a local failure instead of the entire page failing to load. As it stands, the only way for us to fix this is to only run graphql queries on the client (defeating most of the benefits of doing SSR).

@arkoannuk
Copy link

Still relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants