fix(categories): broaden leaf detection to all /extern/*/{vin,mdl}_items endpoints
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

The leaf-path checks only matched /servicepart/vin_items literally, but
PL24's P5 modern catalog ships the same shape under /chemicals/vin_items,
/accessories/vin_items, /chemicals/mdl_items, etc. When user clicked a
"Rötuşkalemseti" (touch-up paint set) category whose linkPath was
/p5vwag/extern/chemicals/vin_items, the code drilled in, treated each
paint chemical's per-part URL (?partno=LLSMAX010) as a sub-category,
and inserted 228 ghost rows under it. Replace the literal substring
match with a regex that covers the whole /extern/{kind}/(vin|mdl)_items
pattern; apply to both the user-vehicle (categories.service) and the
catalog (catalog.service) flows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 10:30:33 +03:00
parent 4a72f2482b
commit 33605ead25
2 changed files with 22 additions and 15 deletions

View File

@@ -1190,8 +1190,12 @@ export class CatalogService {
lower.includes("/bom/") ||
lower.includes("/bomdetails") ||
lower.includes("/partinfo/") ||
lower.includes("/servicepart/vin_items") ||
lower.includes("image-board.action") // PSA illustration leaf
// PL24 P5 leaf items endpoints — chemicals, servicepart, accessories,
// any /extern/<kind>/(vin|mdl)_items combination. These return parts,
// not subgroups, so they must short-circuit drill-down.
/\/extern\/[^/]+\/(vin_items|mdl_items)\b/.test(lower) ||
lower.includes("image-board.action") || // PSA illustration leaf
lower.includes("json-vin-bom-detail.action")
);
}

View File

@@ -517,20 +517,17 @@ export class CategoriesService {
return [];
}
// BOM / servicepart item links are leaf categories — they return parts, not subgroups
// BOM / *_items / partinfo / image-board pages all return PARTS, not
// subgroups. Drilling into them used to insert per-part endpoints as
// ghost child categories — keep the regex wide so any /extern/{kind}/
// (vin|mdl)_items endpoint is recognised, not just /servicepart/.
const lp = linkPath.toLowerCase();
if (
lp.includes("/bom/") ||
lp.includes("/bomdetails") ||
lp.includes("/partinfo/") ||
lp.includes("/servicepart/vin_items") ||
// PSA / Hyundai / Opel / Volvo image-board pages and the Ford VIN
// vin-image-board.action equivalent. Drilling into them yields BOM rows,
// not sub-groups — let getCategoryWithParts handle those as parts.
/\/extern\/[^/]+\/(vin_items|mdl_items)\b/.test(lp) ||
lp.includes("image-board.action") ||
// json-vin-bom-detail.action is the per-part endpoint (one level past a
// leaf). If any code ever inserts it as a category linkPath, treat the
// node as a dead-end leaf so the UI doesn't loop into it.
lp.includes("json-vin-bom-detail.action")
) {
return [];
@@ -1178,11 +1175,17 @@ export class CategoriesService {
? !!c.linkPath && dbChildCount === 0
: c.source === "parts-catalogs"
? !!c.linkPath?.startsWith("pcat:") && dbChildCount === 0
: c.linkPath?.toLowerCase()?.includes("/bom/") ||
c.linkPath?.toLowerCase()?.includes("/bomdetails") ||
c.linkPath?.toLowerCase()?.includes("/partinfo/") ||
c.linkPath?.toLowerCase()?.includes("/servicepart/vin_items") ||
(!c.linkPath && dbChildCount === 0);
: (() => {
const lp = c.linkPath?.toLowerCase() ?? "";
return (
lp.includes("/bom/") ||
lp.includes("/bomdetails") ||
lp.includes("/partinfo/") ||
/\/extern\/[^/]+\/(vin_items|mdl_items)\b/.test(lp) ||
lp.includes("image-board.action") ||
(!c.linkPath && dbChildCount === 0)
);
})();
return {
...c,
schemaImageUrl: picMap.get(c.id) || null,