Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Hybrids: Query Factory

Exports

import { query } from '@apollo-elements/hybrids/factories/query';

query

Hybrids property descriptor factory for GraphQL queries. Setting one will automatically trigger the query, unless noAutoSubscribe is set. Implements the ApolloQueryElement interface.

Parameters

document

DocumentNode | TypedDocumentNode

The query to subscribe to.

options

QueryHybridsFactoryOptions<D, V>

Options to configure the query.

Option Type Description
query
DocumentNode | TypedDocumentNode
A GraphQL document that consists of a single query to be sent down to the server.
variables
Variables<D, V> 
A map going from variable name to variable value, where the variables are used within the GraphQL query.
context
Record<string, unknown>
Context object passed through the link execution chain.
errorPolicy
ErrorPolicy
Error policy to use for the query. See errorPolicy
fetchPolicy
FetchPolicy
See fetchPolicy
nextFetchPolicy
FetchPolicy
See nextFetchPolicy
client
ApolloClient
ApolloClient instance use to make the call.
pollInterval
number
See pollInterval
noAutoSubscribe
boolean
See noAutoSubscribe
notifyOnNetworkStatusChange See notifyOnNetworkStatusChange
partialRefetch
boolean
See partialRefetch
returnPartialData
boolean
See returnPartialData
shouldSubscribe Predicate which determines whether to automatically subscribe. See shouldSubscribe.
onError Callback for when an error occurs. See onError.
onData Callback for when the query resolves. See onData.

Returns

Descriptor<ApolloQueryElement<D, V>>

Hybrids descriptor which mixes the ApolloQueryInterface in on connect.