File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
packages/firestore/src/core Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ export class QueryImpl implements Query {
70
70
// The corresponding `Target` of this `Query` instance.
71
71
memoizedTarget : Target | null = null ;
72
72
73
+ // The corresponding `Target` of this `Query` instance for use with
74
+ // aggregate queries
75
+ memoizedAggregateTarget : Target | null = null ;
76
+
73
77
/**
74
78
* Initializes a Query with a path and optional additional query constraints.
75
79
* Path must currently be empty if this is a collection group query.
@@ -287,8 +291,15 @@ export function queryToTarget(query: Query): Target {
287
291
export function queryToAggregateTarget ( query : Query ) : Target {
288
292
const queryImpl = debugCast ( query , QueryImpl ) ;
289
293
290
- // Do not include implicit order-bys for aggregate queries.
291
- return _queryToTarget ( queryImpl , query . explicitOrderBy ) ;
294
+ if ( ! queryImpl . memoizedAggregateTarget ) {
295
+ // Do not include implicit order-bys for aggregate queries.
296
+ queryImpl . memoizedAggregateTarget = _queryToTarget (
297
+ queryImpl ,
298
+ query . explicitOrderBy
299
+ ) ;
300
+ }
301
+
302
+ return queryImpl . memoizedAggregateTarget ;
292
303
}
293
304
294
305
export function _queryToTarget (
You can’t perform that action at this time.
0 commit comments