Files
apf_portal/apps/portal-shell
Julien Gautier 0e0419ec5e
CI / scan (pull_request) Successful in 3m0s
CI / check (pull_request) Successful in 3m20s
CI / commits (pull_request) Successful in 3m18s
CI / a11y (pull_request) Successful in 2m2s
CI / perf (pull_request) Successful in 5m45s
fix(portal-shell): catch-all route prevents NG04002 on /fr in dev mode
Reproducer: `nx serve portal-shell` (source-locale dev server, no
`--localize`), open the home page, click the locale switcher's
"Français" entry. The switcher rewrites the URL to `/fr/` and
hard-refreshes; the Angular CLI dev server applies its SPA fallback
and serves the same source `index.html` for every path. The source
bundle boots with `<base href="/">`, the router tries to match
`/fr/` and finds no route → `NG04002: Cannot match any routes.
URL Segment: 'fr'` in the bootstrap promise rejection.

Fix: add a `{ path: '**', redirectTo: '' }` catch-all so unknown
paths bounce to home gracefully. In production this is a no-op
because each locale ships with its own `<base href="/{locale}/">`
and the locale segment is stripped before route matching — `/fr/foo`
hits the bundle's `foo` route, not the wildcard. The route also
serves as a defensive 404-to-home for any future bad URL in prod.

The locale switcher's actual limitation in dev (no per-locale
bundle, switching can only land on the source locale) stands; this
just turns the ugly error into a silent bounce so the dev iteration
is not interrupted.
2026-05-11 22:07:50 +02:00
..