Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

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 }
    }
  `;
}

Mixin which prevents query or subscription operations from fetching until their required variables are set.

Signature

ValidateVariablesMixin

Mixin which prevents query or subscription operations from fetching until their required variables are set.

Parameters

superclass

B

An element which implements either ApolloQueryInterface or ApolloSubscriptionInterface.

Properties

shouldSubscribe


Methods

shouldSubscribe

Parameters

options

Partial<SubscriptionOptions>

Exports

import { ValidateVariablesMixin } from '@apollo-elements/mixins/validate-variables-mixin';