22541 unify breadcrumb mapped-route resolver and widen route-map coverage

This commit is contained in:
2026-04-09 10:02:02 +01:00
parent 04dc8fd2b9
commit 786f906ab8
3 changed files with 130 additions and 48 deletions
+37
View File
@@ -392,6 +392,43 @@ Follow-ups:
- Next slice recommendation: introduce a tiny local `renderMappedRoute(path, resolver)` helper to remove repeated inline IIFE map invocations, then optionally merge simple maps under one top-level resolver while preserving explicit ordering and side-effect-free constraints.
### CL-22541-N: breadcrumbs unified mapped-route resolver + widened structural guardrails
date: 2026-04-09
author: Cline
scope: `components/breadcrumbs.js`, `tests/phase22/breadcrumbs-route-map-structure.test.cjs`
type: change
rationale: Execute the requested wider next slice by removing duplicated mapped-route invocation patterns, introducing a single top-level mapped resolver with explicit precedence, and migrating an additional safe my-portal route group into map-driven rendering while preserving explicit dynamic/callback branches.
impact: Refactor-only structural consolidation/readability improvement with widened mapped-route coverage and stronger structure guardrail tests; no intended route/auth/session/API/EN-CY/a11y behavior change.
status: completed
Summary:
- Added `getSimpleMyPortalRouteRenderer(path)` in `components/breadcrumbs.js` and migrated additional safe map-friendly routes:
- `/myportal/searchresults`
- `/myportal/addresssearch`
- `/myportal/advancedsearch`
- `/myportal/contactus`
- `/myportal/viewall`
- Added `resolveMappedRouteRenderer(path)` to unify map precedence under one resolver.
- Added `renderMappedRoute(path, resolver?)` helper and replaced duplicated inline map IIFE invocations with a single call:
- `{renderMappedRoute(pathname)}`
- Kept dynamic/stateful callback branches explicit and unchanged, especially `/myportal/case/id/[incident]` (`router.back()`) and other callback/state driven branches.
- Expanded `tests/phase22/breadcrumbs-route-map-structure.test.cjs` to assert:
- new my-portal route-map entries are present
- unified resolver/helper signatures are present
- single mapped-route invocation is used in JSX
- dynamic callback branch remains explicit.
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: 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-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
date: 2026-04-07