Browse Source

feat(query-builder): Sort tag values by count instead of last_seen (#75097)

Malachi Willey 7 months ago
parent
commit
6d8e96cc3f
2 changed files with 18 additions and 14 deletions
  1. 1 1
      static/app/actionCreators/tags.tsx
  2. 17 13
      static/app/views/issueList/searchBar.tsx

+ 1 - 1
static/app/actionCreators/tags.tsx

@@ -114,7 +114,7 @@ export function fetchTagValues({
   includeTransactions?: boolean;
   projectIds?: string[];
   search?: string;
-  sort?: string;
+  sort?: '-last_seen' | '-count';
 }): Promise<TagValue[]> {
   const url = `/organizations/${orgSlug}/tags/${tagKey}/values/`;
 

+ 17 - 13
static/app/views/issueList/searchBar.tsx

@@ -124,28 +124,32 @@ function IssueListSearchBar({organization, tags, onClose, ...props}: Props) {
         statsPeriod: pageFilters.datetime.period,
       };
 
+      const fetchTagValuesPayload = {
+        api,
+        orgSlug,
+        tagKey: key,
+        search,
+        projectIds,
+        endpointParams,
+        sort: '-count' as const,
+      };
+
       const [eventsDatasetValues, issuePlatformDatasetValues] = await Promise.all([
         fetchTagValues({
-          api,
-          orgSlug,
-          tagKey: key,
-          search,
-          projectIds,
-          endpointParams,
+          ...fetchTagValuesPayload,
           dataset: Dataset.ERRORS,
         }),
         fetchTagValues({
-          api,
-          orgSlug,
-          tagKey: key,
-          search,
-          projectIds,
-          endpointParams,
+          ...fetchTagValuesPayload,
           dataset: Dataset.ISSUE_PLATFORM,
         }),
       ]);
 
-      return mergeAndSortTagValues(eventsDatasetValues, issuePlatformDatasetValues);
+      return mergeAndSortTagValues(
+        eventsDatasetValues,
+        issuePlatformDatasetValues,
+        'count'
+      );
     },
     [
       api,