22541 compose mapped breadcrumb groups in factory and add null fallback guard
This commit is contained in:
@@ -532,6 +532,39 @@ Follow-ups:
|
||||
- Next slice option A (larger): move per-path map object declarations out of `components/breadcrumbs.js` into module-level pure factories (still injected with `t/router/currentView`) to further shrink component body.
|
||||
- Next slice option B (smaller): add one focused parity test asserting mapped resolver fallback returns `null` in component rendering path for non-mapped routes (ensures no accidental render noise).
|
||||
|
||||
### CL-22541-R: breadcrumbs mapped-group factory composition + unmapped-route null parity guard
|
||||
|
||||
date: 2026-04-09
|
||||
author: Cline
|
||||
scope: `lib/routing/breadcrumbRendererFactories.js`, `components/breadcrumbs.js`, `tests/phase22/breadcrumbs-route-map-structure.test.cjs`
|
||||
type: change
|
||||
rationale: Execute both approved next slices in one commit by centralizing deterministic mapped route-group composition into a factory-level helper and adding explicit structure guard coverage for null fallback behavior on unmapped routes.
|
||||
impact: Refactor-only structural consolidation and test hardening; no intended route/auth/session/API/EN-CY/a11y behavior change.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added `createMappedRouteRendererGroups(...)` in `lib/routing/breadcrumbRendererFactories.js` to compose and return all deterministic mapped renderer groups in one place:
|
||||
- `simpleRouteRenderersByPath`
|
||||
- `simpleLinkTextPairRenderersByPath`
|
||||
- `simpleMyPortalRouteRenderersByPath`
|
||||
- `caseDetailRouteRenderersByPath`
|
||||
- `detailAndAccountRouteRenderersByPath`
|
||||
- Updated `components/breadcrumbs.js` to consume `createMappedRouteRendererGroups(...)` and remove local per-group factory composition boilerplate while preserving existing map precedence and resolver flow.
|
||||
- Expanded `tests/phase22/breadcrumbs-route-map-structure.test.cjs` to assert:
|
||||
- grouped renderer maps are composed via `createMappedRouteRendererGroups(...)`
|
||||
- mapped rendering path explicitly preserves null fallback (`routeRenderer ? routeRenderer() : null`)
|
||||
|
||||
Validation:
|
||||
|
||||
- `npx eslint lib/routing/breadcrumbRendererFactories.js components/breadcrumbs.js tests/phase22/breadcrumbs-route-map-structure.test.cjs tests/phase22/breadcrumb-route-maps-helper.test.cjs tests/phase22/index.test.cjs` -> pass.
|
||||
- `node tests/phase22/index.test.cjs` -> pass (combined suite; breadcrumbs-route-map 4/4).
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Next slice option A (larger): extract remaining deterministic inline branches (`/myportal/case`, `/case/id/[incident]` if kept deterministic after constraints review) only if they remain callback/state free.
|
||||
- Next slice option B (smaller): add one focused assertion in helper-level tests that empty grouped map entries are tolerated without affecting precedence resolution.
|
||||
|
||||
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
|
||||
|
||||
date: 2026-04-07
|
||||
|
||||
Reference in New Issue
Block a user