Skip to content

Commit

Permalink
ah - need to use toSorted so you don't mutate
Browse files Browse the repository at this point in the history
  • Loading branch information
robotastic committed Sep 1, 2024
1 parent d5236f3 commit 336e520
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions frontend/src/System/ListSystems.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 336e520

Please sign in to comment.