Skip to content

Commit

Permalink
feat(useLazyQuery): add interface for lazy query return (#1523)
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Chau <[email protected]>
  • Loading branch information
baitun and Akryum authored Jan 15, 2024
1 parent fb66dce commit 2746efa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/vue-apollo-composable/src/useLazyQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { DocumentNode } from 'graphql'
import { isRef } from 'vue-demi'
import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions } from './useQuery'
import { useQueryImpl, DocumentParameter, VariablesParameter, OptionsParameter, UseQueryOptions, UseQueryReturn } from './useQuery'
import type { OperationVariables } from '@apollo/client/core'

export interface UseLazyQueryReturn<TResult, TVariables extends OperationVariables> extends UseQueryReturn<TResult, TVariables> {
load: (document?: DocumentNode | null, variables?: TVariables | null, options?: UseQueryOptions | null) => false | Promise<TResult>
}

export function useLazyQuery<
TResult = any,
Expand All @@ -9,7 +14,7 @@ export function useLazyQuery<
document: DocumentParameter<TResult, TVariables>,
variables?: VariablesParameter<TVariables>,
options?: OptionsParameter<TResult, TVariables>,
) {
): UseLazyQueryReturn<TResult, TVariables> {
const query = useQueryImpl<TResult, TVariables>(document, variables, options, true)

function load (
Expand Down

0 comments on commit 2746efa

Please sign in to comment.