From 992fa53277fa70e739148ab4b5f9d7bf9d97a8b3 Mon Sep 17 00:00:00 2001 From: "Shiv Bhonde | shivbhonde.eth" Date: Thu, 16 Jan 2025 14:09:04 +0530 Subject: [PATCH] update contract sort order in numberic way (#1032) --- packages/nextjs/app/debug/_components/DebugContracts.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nextjs/app/debug/_components/DebugContracts.tsx b/packages/nextjs/app/debug/_components/DebugContracts.tsx index 775f456ad..9822680f3 100644 --- a/packages/nextjs/app/debug/_components/DebugContracts.tsx +++ b/packages/nextjs/app/debug/_components/DebugContracts.tsx @@ -11,7 +11,13 @@ const selectedContractStorageKey = "scaffoldEth2.selectedContract"; export function DebugContracts() { const contractsData = useAllContracts(); - const contractNames = useMemo(() => Object.keys(contractsData) as ContractName[], [contractsData]); + const contractNames = useMemo( + () => + Object.keys(contractsData).sort((a, b) => { + return a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }); + }) as ContractName[], + [contractsData], + ); const [selectedContract, setSelectedContract] = useSessionStorage( selectedContractStorageKey,