Skip to content

Commit

Permalink
fix: Sorting function in GenericList
Browse files Browse the repository at this point in the history
  • Loading branch information
mrCherry97 committed Feb 6, 2025
1 parent dabfa47 commit 1b5f4d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/shared/components/GenericList/GenericList.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ export const GenericList = ({
const sortFunction = Object.entries(sortBy).filter(([name]) => {
return name === sort.name;
})[0][1];

if (sort.order === 'ASC') {
return [...resources.sort(sortFunction)];
return [...resources].sort(sortFunction);
} else {
return [...resources.sort((a, b) => sortFunction(b, a))];
return [...resources].sort((a, b) => sortFunction(b, a));
}
};

Expand Down

0 comments on commit 1b5f4d0

Please sign in to comment.