HASH 5e8749aca96e
DATE 2025-11-16
SUBJECT web: gracefully fail to find runs
FILES 1 CHANGED
HASH 5e8749aca96e
DATE 2025-11-16
SUBJECT web: gracefully fail to find runs
FILES 1 CHANGED
┌─ web/src/pages/challenge-mode/[season]/[...slug].astro ────────────────────┐
│ diff --git a/web/src/pages/challenge-mode/[season]/[...slug].astro b/web/src/pages │
│ /challenge-mode/[season]/[...slug].astro │
│ index 4414cf9..c492d2c 100644 │
│ --- a/web/src/pages/challenge-mode/[season]/[...slug].astro │
│ +++ b/web/src/pages/challenge-mode/[season]/[...slug].astro │
│ @@ -7,6 +7,7 @@ import DungeonFilterSelect from "../../../components/Leaderboard/D │
│ ungeonFilterSe │
│ import LeaderboardScopeFilter from "../../../components/Leaderboard/LeaderboardSc │
│ opeFilter/LeaderboardScopeFilter.astro"; │
│ import LeaderboardTypeNav from "../../../components/Leaderboard/LeaderboardTypeNa │
│ v/LeaderboardTypeNav.astro"; │
│ import PlayerSearch from "../../../components/PlayerSearch/PlayerSearch.astro"; │
│ +import type { LeaderboardData } from "../../../lib/types"; │
│ import { │
│ DUNGEON_MAP, │
│ dungeonNameToSlug, │
│ @@ -75,8 +76,21 @@ if (regionParam === "global") { │
│ scopeLabel = `${regionParam.toUpperCase()} - All Realms`; │
│ } │
│ │
│ -// Fetch leaderboard data │
│ -let data; │
│ +// Fetch leaderboard data with graceful fallback when API file is missing │
│ +const emptyLeaderboardData: LeaderboardData = { │
│ + leading_groups: [], │
│ + pagination: { │
│ + currentPage: currentPage, │
│ + pageSize: 25, │
│ + totalPages: 1, │
│ + hasNextPage: false, │
│ + hasPrevPage: currentPage > 1, │
│ + totalRuns: 0, │
│ + }, │
│ +}; │
│ + │
│ +let data: LeaderboardData = emptyLeaderboardData; │
│ + │
│ try { │
│ data = await fetchLeaderboard( │
│ regionParam, │
│ @@ -89,7 +103,6 @@ try { │
│ ); │
│ } catch (error) { │
│ console.error("[Test Leaderboard] Error:", error); │
│ - throw error; │
│ } │
│ --- │
│ │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...mode/[season]/[...slug].astro ───┐
│ diff --git a/web/src/pages/challenge-mode/[s │
│ eason]/[...slug].astro b/web/src/pages/chall │
│ enge-mode/[season]/[...slug].astro │
│ index 4414cf9..c492d2c 100644 │
│ --- a/web/src/pages/challenge-mode/[season]/ │
│ [...slug].astro │
│ +++ b/web/src/pages/challenge-mode/[season]/ │
│ [...slug].astro │
│ @@ -7,6 +7,7 @@ import DungeonFilterSelect f │
│ rom "../../../components/Leaderboard/Dungeon │
│ FilterSe │
│ import LeaderboardScopeFilter from "../../. │
│ ./components/Leaderboard/LeaderboardScopeFil │
│ ter/LeaderboardScopeFilter.astro"; │
│ import LeaderboardTypeNav from "../../../co │
│ mponents/Leaderboard/LeaderboardTypeNav/Lead │
│ erboardTypeNav.astro"; │
│ import PlayerSearch from "../../../componen │
│ ts/PlayerSearch/PlayerSearch.astro"; │
│ +import type { LeaderboardData } from "../.. │
│ /../lib/types"; │
│ import { │
│ DUNGEON_MAP, │
│ dungeonNameToSlug, │
│ @@ -75,8 +76,21 @@ if (regionParam === "glob │
│ al") { │
│ scopeLabel = `${regionParam.toUpperCase() │
│ } - All Realms`; │
│ } │
│ │
│ -// Fetch leaderboard data │
│ -let data; │
│ +// Fetch leaderboard data with graceful fal │
│ lback when API file is missing │
│ +const emptyLeaderboardData: LeaderboardData │
│ = { │
│ + leading_groups: [], │
│ + pagination: { │
│ + currentPage: currentPage, │
│ + pageSize: 25, │
│ + totalPages: 1, │
│ + hasNextPage: false, │
│ + hasPrevPage: currentPage > 1, │
│ + totalRuns: 0, │
│ + }, │
│ +}; │
│ + │
│ +let data: LeaderboardData = emptyLeaderboar │
│ dData; │
│ + │
│ try { │
│ data = await fetchLeaderboard( │
│ regionParam, │
│ @@ -89,7 +103,6 @@ try { │
│ ); │
│ } catch (error) { │
│ console.error("[Test Leaderboard] Error:" │
│ , error); │
│ - throw error; │
│ } │
│ --- │
│ │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET