Skip to content

Commit 336e520

Browse files
committed
ah - need to use toSorted so you don't mutate
1 parent d5236f3 commit 336e520

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

frontend/src/System/ListSystems.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ const ListSystems = (props) => {
4949

5050
let popularSystems = [];
5151
if (isSuccess && systems.systems) {
52-
const sortedSystems = systems.systems.sort((a, b) => {
53-
54-
return b.clientCount - a.clientCount;
55-
});
56-
popularSystems = sortedSystems.slice(0, 4);
52+
popularSystems = systems.systems.toSorted((a, b) => b.clientCount - a.clientCount).slice(0, 4);
5753
}
5854
const handleContactClick = (system) => {
5955
setContactSystem(system);

0 commit comments

Comments
 (0)