File tree 1 file changed +21
-1
lines changed
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import useOrganization from 'sentry/utils/useOrganization';
19
19
const MAX_PROJECTS_TO_SHOW = 3 ;
20
20
const MAX_TAGS_TO_SHOW = 5 ;
21
21
22
+ const STANDARD_TAGS = [ 'release' , 'environment' , 'transaction' ] ;
23
+
22
24
export function MetricListItemDetails ( {
23
25
metric,
24
26
selectedProjects,
@@ -66,7 +68,25 @@ export function MetricListItemDetails({
66
68
) ;
67
69
68
70
const truncatedProjects = metricProjects . slice ( 0 , MAX_PROJECTS_TO_SHOW ) ;
69
- const truncatedTags = tagsData . slice ( 0 , MAX_TAGS_TO_SHOW ) ;
71
+ // Display custom tags first, then sort alphabetically
72
+ const sortedTags = useMemo (
73
+ ( ) =>
74
+ tagsData . toSorted ( ( a , b ) => {
75
+ const aIsStandard = STANDARD_TAGS . includes ( a . key ) ;
76
+ const bIsStandard = STANDARD_TAGS . includes ( b . key ) ;
77
+
78
+ if ( aIsStandard && ! bIsStandard ) {
79
+ return 1 ;
80
+ }
81
+ if ( ! aIsStandard && bIsStandard ) {
82
+ return - 1 ;
83
+ }
84
+
85
+ return a . key . localeCompare ( b . key ) ;
86
+ } ) ,
87
+ [ tagsData ]
88
+ ) ;
89
+ const truncatedTags = sortedTags . slice ( 0 , MAX_TAGS_TO_SHOW ) ;
70
90
71
91
return (
72
92
< DetailsWrapper >
You can’t perform that action at this time.
0 commit comments