refactor(breadcrumbs): extract representation route-state renderer group
This commit is contained in:
@@ -784,6 +784,55 @@ Follow-ups:
|
||||
|
||||
- Next larger slice candidate remains `/myportal/representation` callback/state branch extraction only if side-effects can be injected/parity-preserved cleanly.
|
||||
|
||||
### CL-22541-Y: breadcrumbs larger slice — representation route-group extraction (`/myportal/representation`)
|
||||
|
||||
date: 2026-04-09
|
||||
author: Cline
|
||||
scope: `lib/routing/{breadcrumbRendererFactories,breadcrumbRouteMaps}.js`, `components/breadcrumbs.js`, `tests/phase22/{breadcrumb-route-maps-helper,breadcrumbs-route-map-structure}.test.cjs`
|
||||
type: change
|
||||
rationale: Execute the queued larger follow-up slice by extracting `/myportal/representation` callback/state breadcrumb branches into a dedicated mapped route group with explicit callback injection while preserving questionnaire/submit side-effects.
|
||||
impact: Structural refactor with preserved representation back-link state behavior; no intended route/auth/session/API/EN-CY/a11y behavior change.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added `createRepresentationRouteRenderers(...)` in `lib/routing/breadcrumbRendererFactories.js` mapping:
|
||||
- `/myportal/representation`
|
||||
- Preserved existing representation-state semantics in mapped handler:
|
||||
- submit/back from confirmation (`setRepresentationSubmit(qcount)`)
|
||||
- non-questionnaire back path (`setRepresentationSubmit(false)`)
|
||||
- questionnaire step-back path (`setShowQuestionnaireSection(showQuestionnaireSection - 1)` + `setRepresentationSubmit(false)`)
|
||||
- Introduced explicit injected state/callback dependencies into grouped composition:
|
||||
- `currentView`, `hasRepDetails`, `repDetails`, `showQuestionnaireSection`
|
||||
- `onRepresentationSubmitBackFromConfirmation`
|
||||
- `onRepresentationSubmitBackToDetails`
|
||||
- `onRepresentationQuestionnaireBack`
|
||||
- Extended `buildBreadcrumbRendererMaps(...)` in `lib/routing/breadcrumbRouteMaps.js` with `representationRouteRenderersByPath` and updated precedence order:
|
||||
- simple -> link-text -> myportal -> new-appeal -> callback -> step-back -> representation -> case detail -> detail/account.
|
||||
- Updated `components/breadcrumbs.js`:
|
||||
- pass representation state/callback injections into `createMappedRouteRendererGroups(...)`
|
||||
- include `representationRouteRenderersByPath` in map builder call
|
||||
- remove inline `isPath("/myportal/representation")` branch block.
|
||||
- Expanded tests:
|
||||
- `tests/phase22/breadcrumb-route-maps-helper.test.cjs`
|
||||
- updated map-count/order assertions to include representation group (9 total)
|
||||
- updated map build fixtures to include `representationRouteRenderersByPath`
|
||||
- `tests/phase22/breadcrumbs-route-map-structure.test.cjs`
|
||||
- assert representation factory export + mapped route presence
|
||||
- assert grouped destructuring includes representation map
|
||||
- assert inline representation branch removal
|
||||
- assert updated map-order invariant includes representation group.
|
||||
|
||||
Validation:
|
||||
|
||||
- `npx eslint lib/routing/breadcrumbRendererFactories.js lib/routing/breadcrumbRouteMaps.js components/breadcrumbs.js tests/phase22/breadcrumb-route-maps-helper.test.cjs tests/phase22/breadcrumbs-route-map-structure.test.cjs tests/phase22/index.test.cjs` -> pass.
|
||||
- `node tests/phase22/index.test.cjs` -> pass (combined suite).
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Next smaller slice candidate: helper-level assertion for missing/undefined representation dependency values yielding no renderer output regressions.
|
||||
- Next larger slice candidate: evaluate whether remaining `/newappeal` edge branch can be absorbed into mapped grouping without reducing readability or explicitness.
|
||||
|
||||
### CL-00X: 22500 `components/elements/index.js` Phase 1 helper extraction
|
||||
|
||||
date: 2026-04-07
|
||||
|
||||
Reference in New Issue
Block a user