Function useAggregateFromServer

  • Returns aggregate of a Firestore Query. Does not update the result once initially calculated.

    Type Parameters

    • T extends AggregateSpec

    Parameters

    • query: undefined | null | Query<unknown, DocumentData>

      Firestore query the aggregate is calculated for

    • aggregateSpec: T

      Aggregate specification

    Returns UseAggregateFromServerResult<T>

    Size of the result set, loading state, and error

    • value: Aggregate of the Firestore query; undefined if the aggregate is currently being calculated, or an error occurred
    • loading: true while calculating the aggregate; false if the aggregate was calculated successfully or an error occurred
    • error: undefined if no error occurred