Class Mixins: ValidateVariablesMixin
Optional mixin which prevents queries from automatically subscribing until their non-nullable variables are defined.
import { ApolloQueryElement } from '@apollo-elements/interfaces';
import { ValidateVariablesMixin } from '@apollo-elements/mixins/validate-variables-mixin';
import { gql } from '@apollo/client/core';
export class ValidatedQueryElement extends ValidateVariablesMixin(ApolloQueryElement) {
query = gql`
query UsersByName($name: String!) {
user { id name }
}
`;
}
Exports
import { ValidateVariablesMixin } from '@apollo-elements/mixins/validate-variables-mixin';
Signature
ValidateVariablesMixin
Mixin which prevents operations from fetching until their required variables are set.
Parameters
superclass
Constructor<ApolloElement>
Returns
Constructor<ApolloElement>
Methods
shouldSubscribe
inherited from ApolloQueryInterfaceOverrides the default shouldSubscribe
predicate to prevent subscription until variables are present.
Parameters
options
Partial<SubscriptionOptions<Variables<D, V>, Data<D>>>
Property | Type | Description |
---|---|---|
query |
|
See query |
variables |
|
See variables |
fetchPolicy |
|
See fetchPolicy |
errorPolicy |
|
See errorPolicy |
context |
|
Context object passed through the link execution chain. |
Returns
boolean