currentScenario()/currentRole() read the URL param before sessionStorage, so a
stale ?scenario=/?role= in the address bar overrode the switcher on reload
("stuck on slow"). The switcher now strips both dev params from the URL
(pure stripDevParams + history.replaceState) before reloading, so the stored
value wins.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.3 KiB
1.3 KiB
WP-37 — Dev-switcher reset fix (scenario/role)
Status: done Phase: 8 — platform/DX/showcase
Why
The WP-33 dev switcher can't reset scenario/role back to default/drafter — it gets "stuck"
(e.g. on slow). Cause: currentScenario()/currentRole() read the URL ?scenario=/?role=
param before sessionStorage, so once a param is in the address bar, location.reload() (same
URL) re-reads the stale value and overrides what the switcher just stored.
Decisions
- Once the switcher is used, sessionStorage is authoritative; a leftover URL param must not
win. Strip both dev params from the URL (
history.replaceState) before reloading. - Extract the URL rewrite as a pure
stripDevParams(href)so it's unit-testable without touchinglocation.reload().
Files
src/app/shared/infrastructure/dev-params.ts(+dev-params.spec.ts) — purestripDevParams.src/app/shared/ui/debug-state/debug-state.component.ts—switchRole/switchScenariocallapplyAndReload()(replaceState with stripped URL, then reload).
Acceptance criteria
- Switching scenario/role to any value (incl. default/drafter) sticks after reload, even when
a
?scenario=/?role=param was in the URL. stripDevParamsremoves both params, keeps other params + path/hash (spec).npm run cigreen.