Skip to content

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

Open
@brunomperes

Description

@brunomperes

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions