From 477cb539d00dc00194b1e1140cfb5d5c81d0a781 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Sat, 22 Jan 2022 13:09:58 +0800 Subject: [PATCH] Explorer: Sort block program ids in filter dropdown (#22674) --- explorer/src/components/block/BlockHistoryCard.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/explorer/src/components/block/BlockHistoryCard.tsx b/explorer/src/components/block/BlockHistoryCard.tsx index f900500cff7b4d..6c3a39cfb1c3a5 100644 --- a/explorer/src/components/block/BlockHistoryCard.tsx +++ b/explorer/src/components/block/BlockHistoryCard.tsx @@ -249,7 +249,13 @@ const FilterDropdown = ({ filterOptions.push({ name, programId, transactionCount }); }); - filterOptions.sort(); + filterOptions.sort((a, b) => { + if (a.transactionCount !== b.transactionCount) { + return b.transactionCount - a.transactionCount; + } else { + return b.name > a.name ? -1 : 1; + } + }); return (