Skip to content

Commit

Permalink
refactor(components): simplify cooccurrence sorting logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Jan 11, 2024
1 parent 67c739b commit fec6036
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions components/CooccurrenceSection/CooccurrenceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ function CooccurrenceSection({ currentArticleId, cooccurrences }: Props) {
});
return Array.from(entries.values()).sort((a, b) => {
if (a.count !== b.count) return b.count - a.count;
if (a.lastCooccurred !== b.lastCooccurred)
return +b.lastCooccurred - +a.lastCooccurred;
return 0;
return +b.lastCooccurred - +a.lastCooccurred;
});
}, [cooccurrences, currentArticleId]);

Expand Down

0 comments on commit fec6036

Please sign in to comment.