From 0bcd240e801c9d623c16df4056d66698d298a5f4 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Wed, 13 Sep 2023 00:06:58 +0300 Subject: [PATCH] Leaderboard: Fix not showing current season by default --- app/features/leaderboards/routes/leaderboards.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/features/leaderboards/routes/leaderboards.tsx b/app/features/leaderboards/routes/leaderboards.tsx index 78559f8dd..908412545 100644 --- a/app/features/leaderboards/routes/leaderboards.tsx +++ b/app/features/leaderboards/routes/leaderboards.tsx @@ -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({