22541 consolidate breadcrumb mapped route maps into grouped constants
This commit is contained in:
@@ -459,6 +459,39 @@ 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-22541-P: breadcrumbs grouped route-map constants + unified map composition point
|
||||
|
||||
date: 2026-04-09
|
||||
author: Cline
|
||||
scope: `components/breadcrumbs.js`, `tests/phase22/breadcrumbs-route-map-structure.test.cjs`
|
||||
type: change
|
||||
rationale: Execute the next wider slice by replacing per-group resolver functions with grouped route-map constants and a single composition array to further improve scanability while preserving route precedence semantics.
|
||||
impact: Refactor-only structural readability improvement; no intended route/auth/session/API/EN-CY/a11y behavior change.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Replaced function-based map accessors with grouped route-map constants in `components/breadcrumbs.js`:
|
||||
- `simpleRouteRenderersByPath`
|
||||
- `simpleLinkTextPairRenderersByPath`
|
||||
- `simpleMyPortalRouteRenderersByPath`
|
||||
- Added unified map composition point:
|
||||
- `mappedRouteRendererMaps` (ordered array preserving precedence)
|
||||
- `getMappedRendererByPath(path, routeRendererMap)` helper
|
||||
- Updated `resolveMappedRouteRenderer(path)` to iterate the composed map list while retaining previous resolution order and behavior.
|
||||
- Kept dynamic/callback branches explicit and unchanged outside map-driven paths.
|
||||
- Expanded structure tests to assert grouped map composition contracts (`mappedRouteRendererMaps`, `getMappedRendererByPath`) in addition to existing resolver and invocation guardrails.
|
||||
|
||||
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 slice option A (larger): extract map constants + resolver helpers into a local `lib/routing/breadcrumbRouteMaps.js` pure module with focused tests, keeping callback/stateful branch rendering in component.
|
||||
- Next slice option B (smaller): expand structure tests to assert explicit map ordering invariants so future reordering regressions are caught early.
|
||||
|
||||
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
|
||||
|
||||
date: 2026-04-07
|
||||
|
||||
Reference in New Issue
Block a user