@@ -64,19 +64,8 @@ export const groupChains = (
6464 setRelayUiKitData ( { starredChainIds : validStarredIds } )
6565 const priorityIds = new Set ( validStarredIds )
6666 starredChains = otherChains
67- . filter (
68- ( chain ) =>
69- ( chain . id && priorityIds . has ( chain . id ) ) ||
70- ( 'tags' in chain && chain . tags && chain . tags . length > 0 )
71- )
72- . sort ( ( a , b ) => {
73- const aHasTags = 'tags' in a && a . tags && a . tags . length > 0
74- const bHasTags = 'tags' in b && b . tags && b . tags . length > 0
75- if ( aHasTags && ! bHasTags ) return - 1
76- if ( ! aHasTags && bHasTags ) return 1
77-
78- return a . displayName . localeCompare ( b . displayName )
79- } )
67+ . filter ( ( chain ) => chain . id && priorityIds . has ( chain . id ) )
68+ . sort ( ( a , b ) => a . displayName . localeCompare ( b . displayName ) )
8069 } else {
8170 // No valid popular chains found, return empty array
8271 starredChains = [ ]
@@ -88,19 +77,8 @@ export const groupChains = (
8877 // User has starred chains, show them
8978 const priorityIds = new Set ( starredChainIds )
9079 starredChains = otherChains
91- . filter (
92- ( chain ) =>
93- ( chain . id && priorityIds . has ( chain . id ) ) ||
94- ( 'tags' in chain && chain . tags && chain . tags . length > 0 )
95- )
96- . sort ( ( a , b ) => {
97- const aHasTags = 'tags' in a && a . tags && a . tags . length > 0
98- const bHasTags = 'tags' in b && b . tags && b . tags . length > 0
99- if ( aHasTags && ! bHasTags ) return - 1
100- if ( ! aHasTags && bHasTags ) return 1
101-
102- return a . displayName . localeCompare ( b . displayName )
103- } )
80+ . filter ( ( chain ) => chain . id && priorityIds . has ( chain . id ) )
81+ . sort ( ( a , b ) => a . displayName . localeCompare ( b . displayName ) )
10482 }
10583
10684 return {
@@ -114,12 +92,7 @@ export const groupChains = (
11492
11593export const sortChains = ( chains : RelayChain [ ] ) => {
11694 return chains . sort ( ( a , b ) => {
117- // First sort by tags
118- if ( ( a . tags ?. length || 0 ) > 0 && ( b . tags ?. length || 0 ) === 0 ) return - 1
119- if ( ( a . tags ?. length || 0 ) === 0 && ( b . tags ?. length || 0 ) > 0 ) return 1
120- if ( ( a . tags ?. length || 0 ) > 0 && ( b . tags ?. length || 0 ) > 0 ) return 0
121-
122- // Then sort by priority chains
95+ // First sort by priority chains
12396 const aIsPriority = POPULAR_CHAIN_IDS . has ( a . id )
12497 const bIsPriority = POPULAR_CHAIN_IDS . has ( b . id )
12598 if ( aIsPriority && ! bIsPriority ) return - 1
0 commit comments