Type alias UseExecuteQueryReturn<T, U>

UseExecuteQueryReturn<T, U>: [ExecutionFunction<U>, {
    ditto?: Ditto;
    error: unknown;
    isLoading: boolean;
    items?: QueryResultItem<T>[];
    mutatedDocumentIDs?: string[];
    reset: (() => void);
}]

Return value of useExecuteQuery.

Type Parameters

  • T

    The type of the items returned by the query. Be aware that this is a convenience type that is not checked against the query being run.

  • U extends DQLQueryArguments = DQLQueryArguments

    The type of query arguments.

Type declaration

  • Optional ditto?: Ditto

    The Ditto instance used by this hook. undefined until an execute() call resolves an instance — set once the instance is found (before the query runs) and retained afterwards, including across reset. Note this stays undefined even with the non-lazy provider until the first execute() call.

  • error: unknown

    The most recent error that resulted from query execution

    Use the onError callback parameter when setting up the hook or the onError parameter of .0 | the execution function to handle errors as they occur.

  • isLoading: boolean

    true while a call to the execution function is pending. Resetting the query with reset will not set this back to true to avoid flickering when used in UIs.

  • Optional items?: QueryResultItem<T>[]

    The items returned by the most recent successful execution.

    undefined until an execution succeeds, and again while a call is in flight or after one fails (use isLoading and error to distinguish those cases).

  • Optional mutatedDocumentIDs?: string[]

    IDs of documents that were mutated locally by the most recent successful execution. An empty array when nothing was mutated, and undefined before the first successful execution.

    See QueryResult.mutatedDocumentIDsV2.

  • reset: (() => void)

    Reset the state of this hook.

    This resets error, items, and mutatedDocumentIDs to their initial state.

    This does not set isLoading to true during the reset process.

      • (): void
      • Returns void