From 59d3ed287ca82b22eccb2c9e11ff5b7f677cbc3d Mon Sep 17 00:00:00 2001 From: robbond Date: Thu, 9 Apr 2026 09:26:19 +0100 Subject: [PATCH] 22541 expand breadcrumb route-state helpers for label and dns path reuse --- components/breadcrumbs.js | 32 +++++------------ components/case/summary.js | 11 +++--- lib/routing/routeState.js | 32 +++++++++++++++++ memory-bank/change-log.md | 31 ++++++++++++++++ tests/phase22/route-state-helper.test.cjs | 44 ++++++++++++++++++++++- 5 files changed, 120 insertions(+), 30 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 8cad3c16..bf48acf2 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -13,8 +13,8 @@ import { setRepresentationSubmit } from "../store/currentView/action"; import { - normalizeRouteStateQuery, - resolveSearchResultsHref + resolveSearchResultsHref, + resolveSearchBreadcrumbLabel } from "../lib/routing/routeState"; const Breadcrumbs = (props) => { const { @@ -73,9 +73,6 @@ const Breadcrumbs = (props) => { ? 9 : ""; - const routeState = normalizeRouteStateQuery(router.query); - const { viewAll, advanced, address, key } = routeState; - const hideServiceNamePaths = [ "/myportal/[appealtypes]", "/newappeal", @@ -112,24 +109,13 @@ const Breadcrumbs = (props) => { fallbackToMyPortalWhenNoFlags: false }); - const breadcrumbLabel = (() => { - if (viewAll) { - return getViewAllLabel(key); - } - - const keyedLabel = getViewAllLabel(key); - if (keyedLabel) return keyedLabel; - - if (advanced) { - return t("common:breadcrumb-advanced-search-results"); - } - - if (address) { - return t("common:breadcrumb-address-search-results"); - } - - return t("common:breadcrumb-search-results"); - })(); + const breadcrumbLabel = resolveSearchBreadcrumbLabel({ + query: router.query, + getViewAllLabel, + advancedLabel: t("common:breadcrumb-advanced-search-results"), + addressLabel: t("common:breadcrumb-address-search-results"), + defaultLabel: t("common:breadcrumb-search-results") + }); return ( <>