Leaderboard: Fix not showing current season by default

This commit is contained in:
Kalle
2023-09-13 00:06:58 +03:00
parent c5b39208fb
commit 0bcd240e80

View File

@@ -104,8 +104,9 @@ export const loader = async ({ request }: LoaderArgs) => {
LEADERBOARD_TYPES.find((type) => type === unvalidatedType) ??
LEADERBOARD_TYPES[0];
const season =
allSeasons(new Date()).find((s) => s === Number(unvalidatedSeason)) ??
currentOrPreviousSeason(new Date())!.nth;
allSeasons(new Date()).find(
(s) => unvalidatedSeason && s === Number(unvalidatedSeason),
) ?? currentOrPreviousSeason(new Date())!.nth;
const userLeaderboard = type.includes("USER")
? await cachified({