From 406684f4a2d8eff3470feeec568bc6bdd39d6cc8 Mon Sep 17 00:00:00 2001 From: seb Date: Tue, 4 Aug 2026 01:35:48 +0200 Subject: [PATCH] slug fix --- src/pages/artikel/categoryRoute.js | 2 +- src/store/categorySlice.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/artikel/categoryRoute.js b/src/pages/artikel/categoryRoute.js index a2a6e27..79b7aea 100644 --- a/src/pages/artikel/categoryRoute.js +++ b/src/pages/artikel/categoryRoute.js @@ -53,7 +53,7 @@ export function resolveCategoryIdFromSlugPath(categories, rootCategoryId, slugPa for (const slug of segments) { const children = getCategoryChildren(categories, currentId); const match = children.find( - (child) => categorySlug(child.name, child.id, rootCategoryId) === slug, + (child) => categorySlug(child, rootCategoryId) === slug, ); if (!match) return null; currentId = match.id; diff --git a/src/store/categorySlice.js b/src/store/categorySlice.js index 12dbca5..233be85 100644 --- a/src/store/categorySlice.js +++ b/src/store/categorySlice.js @@ -47,12 +47,11 @@ export function categoryDisplayName(name, categoryId, rootCategoryId) { return name?.trim() || ''; } -export function categorySlug(name, categoryId, rootCategoryId) { - if (rootCategoryId != null && String(categoryId) === String(rootCategoryId)) { +export function categorySlug(node, rootCategoryId) { + if (rootCategoryId != null && String(node.id) === String(rootCategoryId)) { return ROOT_CATEGORY_NAME; } - const trimmed = name?.trim(); - return trimmed || null; + return node.slug || null; } export function normalizeCategoryMap(data, companyRootCategoryId) { @@ -82,7 +81,7 @@ export function getCategoryBreadcrumbs(categories, currentCategoryId, rootCatego crumbs.unshift({ id: node.id, name: categoryDisplayName(node.name, node.id, rootCategoryId), - slug: categorySlug(node.name, node.id, rootCategoryId), + slug: categorySlug(node, rootCategoryId), }); const parentId = node.parentId;