UseQueryOptions

In adition to the data returned by the query, use-aragon hooks return an object with a multitude of status flags and functions. This object is called the UseQueryResult object.


Kitchen Sink

kitchen sink example of all possible properties returned by a use-aragon query.

{
  const {
    data,
    dataUpdatedAt,
    error,
    errorUpdatedAt,
    failureCount,
    isError,
    isFetched,
    isFetchedAfterMount,
    isFetching,
    isIdle,
    isLoading,
    isLoadingError,
    isPlaceholderData,
    isPreviousData,
    isRefetchError,
    isRefetching,
    isStale,
    isSuccess,
    refetch,
    remove,
    status,
  } useFetchDao({addressOrEns: 'box.dao.eth'})
}

  • Name
    status
    Type
    string
    Description

    The current status of the query, which can be idle, loading, error, or success.

  • Name
    isIdle
    Type
    boolean
    Description

    A derived boolean from the status variable, indicating if the query is currently idle.

  • Name
    isLoading
    Type
    boolean
    Description

    A derived boolean from the status variable, indicating if the query is currently loading.

  • Name
    isSuccess
    Type
    boolean
    Description

    A derived boolean from the status variable, indicating if the query has successfully loaded data.

  • Name
    isError
    Type
    boolean
    Description

    A derived boolean from the status variable, indicating if the query has encountered an error.

  • Name
    isLoadingError
    Type
    boolean
    Description

    A boolean indicating if the query has failed while fetching for the first time.

  • Name
    isRefetchError
    Type
    boolean
    Description

    A boolean indicating if the query has failed while refetching.

  • Name
    data
    Type
    TData
    Description

    The last successfully resolved data for the query, defaulting to undefined.

  • Name
    dataUpdatedAt
    Type
    number
    Description

    The timestamp for when the query most recently returned the status as "success".

  • Name
    error
    Type
    null | TError
    Description

    The error object for the query, if an error was thrown, defaulting to null.

  • Name
    errorUpdatedAt
    Type
    number
    Description

    The timestamp for when the query most recently returned the status as "error".

  • Name
    isStale
    Type
    boolean
    Description

    A boolean indicating if the data in the cache is invalidated or if the data is older than the given staleTime.

  • Name
    isPlaceholderData
    Type
    boolean
    Description

    A boolean indicating if the data shown is the placeholder data.

  • Name
    isPreviousData
    Type
    boolean
    Description

    A boolean indicating if keepPreviousData is set and data from the previous query is returned.

  • Name
    isFetched
    Type
    boolean
    Description

    A boolean indicating if the query has been fetched.

  • Name
    isFetchedAfterMount
    Type
    boolean
    Description

    A boolean indicating if the query has been fetched after the component mounted.

  • Name
    isFetching
    Type
    boolean
    Description

    A boolean indicating if the query is currently fetching, including background fetching.

  • Name
    isRefetching
    Type
    boolean
    Description

    A boolean indicating if a background refetch is currently in-flight, which does not include initial loading.

  • Name
    failureCount
    Type
    number
    Description

    The failure count for the query, incremented every time the query fails and reset to 0 when the query succeeds.

  • Name
    errorUpdateCount
    Type
    number
    Description

    The sum of all errors.

  • Name
    refetch
    Type
    (options: { throwOnError: boolean, cancelRefetch: boolean }) => Promise<UseQueryResult>
    Description

    A function to manually refetch the query, with options to throw an error or cancel the current request.

  • Name
    remove
    Type
    () => void
    Description

    A function to remove the query from the cache.