HASH 6b707ee24261
DATE 2026-05-02
SUBJECT web: fix class filter routing for class slugs without underscore
FILES 1 CHANGED
HASH 6b707ee24261
DATE 2026-05-02
SUBJECT web: fix class filter routing for
class slugs without underscore
FILES 1 CHANGED
┌─ .../components/PlayerProfile/ClassFilterSelect/ClassFilterSelect.astro ───┐
│ diff --git a/web/src/components/PlayerProfile/ClassFilterSelect/ClassFilterSelect. │
│ astro b/web/src/components/PlayerProfile/ClassFilterSelect/ClassFilterSelect.astro │
│ index c818387..37f846a 100644 │
│ --- a/web/src/components/PlayerProfile/ClassFilterSelect/ClassFilterSelect.astro │
│ +++ b/web/src/components/PlayerProfile/ClassFilterSelect/ClassFilterSelect.astro │
│ @@ -80,6 +80,14 @@ const classes = [ │
│ let newPath: string; │
│ const scopeParts = pathParts.slice(playersIndex + 1); │
│ │
│ + // Class slugs (must match wow-constants.ts CLASSES). Used to disambiguate │
│ + // `players/<region>/<class>` from `players/<region>/<realm>` - the previou │
│ s │
│ + // `.includes("_")` heuristic only matched `death_knight`. │
│ + const CLASS_SLUGS = [ │
│ + "death_knight", "druid", "hunter", "mage", "monk", "paladin", │
│ + "priest", "rogue", "shaman", "warlock", "warrior", │
│ + ]; │
│ + │
│ if (scopeParts.length === 0 || scopeParts[0] === "global") { │
│ // Global scope │
│ newPath = `/${basePath}/${seasonSlug}/players/global${selectedClass !== " │
│ all" ? "/" + selectedClass : ""}`; │
│ @@ -89,7 +97,7 @@ const classes = [ │
│ // Check if second part is a class or realm │
│ if ( │
│ scopeParts.length === 1 || │
│ - (scopeParts.length >= 2 && scopeParts[1].includes("_")) │
│ + (scopeParts.length >= 2 && CLASS_SLUGS.includes(scopeParts[1])) │
│ ) { │
│ // Regional scope (region or region/class) │
│ newPath = `/${basePath}/${seasonSlug}/players/${region}${selectedClass │
│ !== "all" ? "/" + selectedClass : ""}`; │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...elect/ClassFilterSelect.astro ───┐
│ diff --git a/web/src/components/PlayerProfil │
│ e/ClassFilterSelect/ClassFilterSelect.astro │
│ b/web/src/components/PlayerProfile/ClassFilt │
│ erSelect/ClassFilterSelect.astro │
│ index c818387..37f846a 100644 │
│ --- a/web/src/components/PlayerProfile/Class │
│ FilterSelect/ClassFilterSelect.astro │
│ +++ b/web/src/components/PlayerProfile/Class │
│ FilterSelect/ClassFilterSelect.astro │
│ @@ -80,6 +80,14 @@ const classes = [ │
│ let newPath: string; │
│ const scopeParts = pathParts.slice(pl │
│ ayersIndex + 1); │
│ │
│ + // Class slugs (must match wow-consta │
│ nts.ts CLASSES). Used to disambiguate │
│ + // `players/<region>/<class>` from `p │
│ layers/<region>/<realm>` - the previous │
│ + // `.includes("_")` heuristic only ma │
│ tched `death_knight`. │
│ + const CLASS_SLUGS = [ │
│ + "death_knight", "druid", "hunter", │
│ "mage", "monk", "paladin", │
│ + "priest", "rogue", "shaman", "warlo │
│ ck", "warrior", │
│ + ]; │
│ + │
│ if (scopeParts.length === 0 || scopeP │
│ arts[0] === "global") { │
│ // Global scope │
│ newPath = `/${basePath}/${seasonSlu │
│ g}/players/global${selectedClass !== "all" ? │
│ "/" + selectedClass : ""}`; │
│ @@ -89,7 +97,7 @@ const classes = [ │
│ // Check if second part is a class │
│ or realm │
│ if ( │
│ scopeParts.length === 1 || │
│ - (scopeParts.length >= 2 && scopeP │
│ arts[1].includes("_")) │
│ + (scopeParts.length >= 2 && CLASS_ │
│ SLUGS.includes(scopeParts[1])) │
│ ) { │
│ // Regional scope (region or regi │
│ on/class) │
│ newPath = `/${basePath}/${seasonS │
│ lug}/players/${region}${selectedClass !== "a │
│ ll" ? "/" + selectedClass : ""}`; │
└──────────────────────────────────────────────┘
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET