Apollo Elements Guides API Blog

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>