ah - need to use toSorted so you don't mutate

This commit is contained in:
Luke Berndt
2024-09-01 10:26:18 -04:00
parent d5236f31e2
commit 336e520913

View File

@@ -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);