/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { DeclarativeMutationConfig, Disposable, GraphQLTaggedNode, IEnvironment, MutationConfig, MutationParameters, PayloadError, SelectorStoreUpdater, UploadableMap, VariablesOf, } from 'relay-runtime'; export interface UseMutationConfig { variables: VariablesOf; updater?: SelectorStoreUpdater | null | undefined; uploadables?: UploadableMap | undefined; optimisticUpdater?: SelectorStoreUpdater | null | undefined; optimisticResponse?: TMutation['rawResponse'] | undefined; configs?: DeclarativeMutationConfig[] | undefined; onError?: ((error: Error) => void | null) | undefined; onCompleted?: ((response: TMutation['response'], errors: PayloadError[] | null) => void | null) | undefined; onUnsubscribe?: (() => void | null) | undefined; } export function useMutation( mutation: GraphQLTaggedNode, commitMutationFn?: (environment: IEnvironment, config: MutationConfig) => Disposable, ): [(config: UseMutationConfig) => Disposable, boolean];