Skip to content

Latest commit

 

History

History
178 lines (111 loc) · 2.82 KB

useSuspenseQuery-options.mdx

File metadata and controls

178 lines (111 loc) · 2.82 KB
Name /
Type
Description

Operation options

variables

{ [key: string]: any }

An object containing all of the GraphQL variables your query requires to execute.

Each key in the object corresponds to a variable name, and that key's value corresponds to the variable value.

errorPolicy

ErrorPolicy

Specifies how the query handles a response that returns both GraphQL errors and partial results.

For details, see GraphQL error policies.

The default value is none, which causes the hook to throw the error.

Networking options

suspensePolicy

SuspensePolicy

Determines whether the component should re-suspend when refetching data. Set to initial to avoid re-suspending the component on a refetch.

The default value is always, which will cause the component to always re-suspend when refetching data.

context

Record<string, any>

If you're using Apollo Link, this object is the initial value of the context object that's passed along your link chain.

client

ApolloClient

The instance of ApolloClient to use to execute the query.

By default, the instance that's passed down via context is used, but you can provide a different instance here.

queryKey

string | number | any[]

A unique identifier for the query. Each item in the array must be a stable identifier to prevent infinite fetches.

This is useful when using the same query and variables combination in more than one component, otherwise the components may clobber each other. This can also be used to force the query to re-evaluate fresh.

Caching options

fetchPolicy

SuspenseQueryHookFetchPolicy

Specifies how the query interacts with the Apollo Client cache during execution (for example, whether it checks the cache for results before sending a request to the server).

For details, see Setting a fetch policy. This hook only supports the cache-first, network-only, no-cache, and cache-and-network fetch policies.

The default value is cache-first.

returnPartialData

boolean

If true, the query can return partial results from the cache if the cache doesn't contain results for all queried fields.

The default value is false.