File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,7 +199,19 @@ export default function Groups() {
199199 return aPriority - bPriority ;
200200 }
201201
202- // If same priority, sort alphabetically by name
202+ // If same priority, sort by member count (descending), then alphabetically by name
203+ const aStats = communityStats ? communityStats [ aId ] : undefined ;
204+ const bStats = communityStats ? communityStats [ bId ] : undefined ;
205+
206+ const aMemberCount = aStats ? aStats . participants . size : 0 ;
207+ const bMemberCount = bStats ? bStats . participants . size : 0 ;
208+
209+ // Sort by member count (descending)
210+ if ( aMemberCount !== bMemberCount ) {
211+ return bMemberCount - aMemberCount ;
212+ }
213+
214+ // If same member count, sort alphabetically by name
203215 const aNameTag = a . tags . find ( ( tag ) => tag [ 0 ] === "name" ) ;
204216 const bNameTag = b . tags . find ( ( tag ) => tag [ 0 ] === "name" ) ;
205217
@@ -218,6 +230,7 @@ export default function Groups() {
218230 isGroupPinned ,
219231 userMembershipMap ,
220232 pendingJoinRequestsSet ,
233+ communityStats ,
221234 ] ) ;
222235
223236 // Loading state skeleton with stable keys
You can’t perform that action at this time.
0 commit comments