From 336e520913eaef77839ba1e6644eb692447b6abc Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Sun, 1 Sep 2024 10:26:18 -0400 Subject: [PATCH] ah - need to use toSorted so you don't mutate --- frontend/src/System/ListSystems.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/System/ListSystems.js b/frontend/src/System/ListSystems.js index da6536a..388041c 100644 --- a/frontend/src/System/ListSystems.js +++ b/frontend/src/System/ListSystems.js @@ -49,11 +49,7 @@ const ListSystems = (props) => { let popularSystems = []; if (isSuccess && systems.systems) { - const sortedSystems = systems.systems.sort((a, b) => { - - return b.clientCount - a.clientCount; - }); - popularSystems = sortedSystems.slice(0, 4); + popularSystems = systems.systems.toSorted((a, b) => b.clientCount - a.clientCount).slice(0, 4); } const handleContactClick = (system) => { setContactSystem(system);