Skip to content

Commit

Permalink
fix: πŸ› sorting cards by id and release date for tw, kr region
Browse files Browse the repository at this point in the history
  • Loading branch information
candela97 authored and dnaroma committed Oct 29, 2023
1 parent 9dc2377 commit 684b840
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/card/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ const CardList: React.FC<{}> = observer(() => {
case "id":
case "releaseAt": {
let sortKey: "id" | "releaseAt" | "archivePublishedAt" = sortBy;
if (region === "tw") sortKey = "archivePublishedAt";
if (sortKey === "releaseAt" && ["tw", "kr"].includes(region)) {
sortKey = "archivePublishedAt";
}
result = result.sort((a, b) =>
sortType === "asc"
? (a[sortKey] || 0) - (b[sortKey] || 0)
Expand Down

0 comments on commit 684b840

Please sign in to comment.