UNPKG

@airbnb/lunar-apollo

Version:

Apollo and GraphQL utilities.

37 lines 1.57 kB
import React from 'react'; import { MutationComponentOptions, OperationVariables } from 'react-apollo'; import { ApolloError } from 'apollo-client'; import { RenderableProp } from '@airbnb/lunar/lib/utils/renderElementOrFunction'; export declare type Props<Data, Vars> = Omit<MutationComponentOptions<Data, Vars>, 'client'> & { /** * Render an element or a function that returns an element when an error occurs. * The function is passed the `ApolloError` as an argument. * When not defined, this defaults to `ErrorMessage`. */ error?: RenderableProp<ApolloError>; /** * Render an element or a function that returns an element while loading. * When not defined, this defaults to `Loader`. */ loading?: RenderableProp; /** * Allow graphql errors to be passed to the render function. If this is true the render function * may receive partial data and is expected to be able to handle `result.error.graphQLErrors` */ ignoreGraphQLErrors?: boolean; }; /** * A declarative component to make GraphQL mutations. * Based on Apollo's [Mutation](https://www.apollographql.com/docs/react/essentials/mutations.html#props) component. */ export default class Mutation<Data = {}, Vars = OperationVariables> extends React.Component<Props<Data, Vars>> { static defaultProps: { awaitRefetchQueries: boolean; ignoreGraphQLErrors: boolean; ignoreResults: boolean; variables: {}; }; private handleRender; render(): JSX.Element; } //# sourceMappingURL=index.d.ts.map