Skip to content

Commit a814ca3

Browse files
committed
remove duplicate default initializers
1 parent f81face commit a814ca3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

static/app/views/explore/metrics/metricQuery.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export function encodeMetricQueryParams(metricQuery: BaseMetricQuery): string {
107107
export function defaultMetricQuery({
108108
type = 'aggregate',
109109
}: {type?: 'aggregate' | 'equation'} = {}): BaseMetricQuery {
110+
const newFields =
111+
type === 'equation' ? [defaultAggregateEquation()] : defaultAggregateFields();
110112
return {
111113
metric: {name: '', type: ''},
112114
queryParams: new ReadableQueryParams({
@@ -119,11 +121,8 @@ export function defaultMetricQuery({
119121
sortBys: defaultSortBys(defaultFields()),
120122

121123
aggregateCursor: '',
122-
aggregateFields:
123-
type === 'equation' ? [defaultAggregateEquation()] : defaultAggregateFields(),
124-
aggregateSortBys: defaultAggregateSortBys(
125-
type === 'equation' ? [defaultAggregateEquation()] : defaultAggregateFields()
126-
),
124+
aggregateFields: newFields,
125+
aggregateSortBys: defaultAggregateSortBys(newFields),
127126
}),
128127
};
129128
}

0 commit comments

Comments
 (0)