22541 map myportal results pair routes through unified breadcrumb resolver
This commit is contained in:
+31
-36
@@ -194,7 +194,37 @@ const Breadcrumbs = (props) => {
|
||||
getViewAllLabel(
|
||||
currentViewState.viewKey || router.query.key
|
||||
)
|
||||
)
|
||||
),
|
||||
"/myportal/advancedsearchresults": () => (
|
||||
<>
|
||||
{renderMyPortalCrumb()}
|
||||
{renderLinkCrumb(
|
||||
isWelsh
|
||||
? router.locale + "/myportal/advancedsearch"
|
||||
: "/myportal/advancedsearch",
|
||||
t("common:breadcrumb-advanced-search")
|
||||
)}
|
||||
{renderTextCrumb(
|
||||
t("common:breadcrumb-advanced-search-results")
|
||||
)}
|
||||
</>
|
||||
),
|
||||
"/myportal/addresssearchresults": () => (
|
||||
<>
|
||||
{renderMyPortalCrumb()}
|
||||
{renderLinkCrumb(
|
||||
isWelsh
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/chwiliadcyfeiriadau"
|
||||
: "/myportal/addresssearch",
|
||||
t("common:breadcrumb-address-search")
|
||||
)}
|
||||
{renderTextCrumb(
|
||||
t("common:breadcrumb-address-search-results")
|
||||
)}
|
||||
</>
|
||||
)
|
||||
};
|
||||
|
||||
return simpleMyPortalRouteRenderersByPath[path] || null;
|
||||
@@ -318,41 +348,6 @@ const Breadcrumbs = (props) => {
|
||||
)}
|
||||
|
||||
{renderMappedRoute(pathname)}
|
||||
{isPath("/myportal/advancedsearchresults") && (
|
||||
<>
|
||||
{renderMyPortalCrumb()}
|
||||
{renderLinkCrumb(
|
||||
isWelsh
|
||||
? router.locale +
|
||||
"/myportal/advancedsearch"
|
||||
: "/myportal/advancedsearch",
|
||||
t("common:breadcrumb-advanced-search")
|
||||
)}
|
||||
{renderTextCrumb(
|
||||
t(
|
||||
"common:breadcrumb-advanced-search-results"
|
||||
)
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{isPath("/myportal/addresssearchresults") && (
|
||||
<>
|
||||
{renderMyPortalCrumb()}
|
||||
{renderLinkCrumb(
|
||||
isWelsh
|
||||
? "/" +
|
||||
router.locale +
|
||||
"/fymhorth/chwiliadcyfeiriadau"
|
||||
: "/myportal/addresssearch",
|
||||
t("common:breadcrumb-address-search")
|
||||
)}
|
||||
{renderTextCrumb(
|
||||
t(
|
||||
"common:breadcrumb-address-search-results"
|
||||
)
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{isPath("/newappeal") && <></>}
|
||||
{isPath("/newappeal/[appealtypes]") && (
|
||||
<>
|
||||
|
||||
@@ -429,6 +429,36 @@ Follow-ups:
|
||||
|
||||
- Next wider slice candidate: move a second safe myportal results pair group (`/myportal/advancedsearchresults`, `/myportal/addresssearchresults`) into the unified mapped resolver where callback-free, then consider splitting resolver maps into a dedicated local constant section for improved scanability.
|
||||
|
||||
### CL-22541-O: breadcrumbs myportal results-pair migration into unified mapped resolver
|
||||
|
||||
date: 2026-04-09
|
||||
author: Cline
|
||||
scope: `components/breadcrumbs.js`, `tests/phase22/breadcrumbs-route-map-structure.test.cjs`
|
||||
type: change
|
||||
rationale: Execute the agreed next slice by migrating the remaining callback-free myportal results-pair branches into the unified mapped resolver so more safe branches are rendered through one consistent mapping flow.
|
||||
impact: Refactor-only structural consolidation/readability improvement; no intended route/auth/session/API/EN-CY/a11y behavior change.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Extended `getSimpleMyPortalRouteRenderer(path)` to include:
|
||||
- `/myportal/advancedsearchresults`
|
||||
- `/myportal/addresssearchresults`
|
||||
- Removed now-redundant explicit conditional branches for those two routes from the main JSX chain.
|
||||
- Kept callback/stateful branches explicit and unchanged (notably `/myportal/case/id/[incident]` with `router.back()`).
|
||||
- Expanded `tests/phase22/breadcrumbs-route-map-structure.test.cjs` guardrails to assert:
|
||||
- both myportal results-pair routes are mapped
|
||||
- legacy explicit `isPath(...)` branches for those routes are no longer present
|
||||
|
||||
Validation:
|
||||
|
||||
- `npx eslint components/breadcrumbs.js tests/phase22/breadcrumbs-route-map-structure.test.cjs tests/phase22/index.test.cjs` -> pass.
|
||||
- `node tests/phase22/index.test.cjs` -> pass (combined suite; breadcrumbs-route-map tests 3/3).
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Next wider slice candidate: split map resolver sections into clearly named grouped constants (simple/public/myportal) near one composition point, then optionally move map-only route renderers to a local pure helper module if continued growth impacts scanability.
|
||||
|
||||
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
|
||||
|
||||
date: 2026-04-07
|
||||
|
||||
@@ -42,6 +42,18 @@ test("breadcrumbs/simple-link-text map includes address and advanced search resu
|
||||
true,
|
||||
"Expected /myportal/viewall to be mapped in getSimpleMyPortalRouteRenderer"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('"/myportal/advancedsearchresults": () => ('),
|
||||
true,
|
||||
"Expected /myportal/advancedsearchresults to be mapped in getSimpleMyPortalRouteRenderer"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('"/myportal/addresssearchresults": () => ('),
|
||||
true,
|
||||
"Expected /myportal/addresssearchresults to be mapped in getSimpleMyPortalRouteRenderer"
|
||||
);
|
||||
});
|
||||
|
||||
test("breadcrumbs/merged resolver renders mapped routes through single helper invocation", async () => {
|
||||
@@ -66,6 +78,18 @@ test("breadcrumbs/merged resolver renders mapped routes through single helper in
|
||||
true,
|
||||
"Expected breadcrumb JSX to use single mapped route render invocation"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('isPath("/myportal/advancedsearchresults")'),
|
||||
false,
|
||||
"Expected /myportal/advancedsearchresults explicit branch to be removed after mapping"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
source.includes('isPath("/myportal/addresssearchresults")'),
|
||||
false,
|
||||
"Expected /myportal/addresssearchresults explicit branch to be removed after mapping"
|
||||
);
|
||||
});
|
||||
|
||||
test("breadcrumbs/dynamic callback branch remains explicit for myportal case incident route", async () => {
|
||||
|
||||
Reference in New Issue
Block a user