fix(dev): dev switcher reflects the current role/scenario in the dropdowns
The WP-33 panel's <select [value]> was applied before the @for options existed, so the matching option was never selected (dropdown always showed the first item). Move selection to [selected] on each <option>, and read role/scenario via getters (currentRole()/currentScenario()) so the dropdowns reflect the active value whenever the panel opens. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -95,17 +95,17 @@ import { redactProfile } from './mask';
|
|||||||
<div class="switchers">
|
<div class="switchers">
|
||||||
<label
|
<label
|
||||||
>role
|
>role
|
||||||
<select [value]="role" (change)="switchRole($any($event.target).value)">
|
<select (change)="switchRole($any($event.target).value)">
|
||||||
@for (r of roles; track r) {
|
@for (r of roles; track r) {
|
||||||
<option [value]="r">{{ r }}</option>
|
<option [value]="r" [selected]="r === role">{{ r }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label
|
<label
|
||||||
>scenario
|
>scenario
|
||||||
<select [value]="scenario" (change)="switchScenario($any($event.target).value)">
|
<select (change)="switchScenario($any($event.target).value)">
|
||||||
@for (s of scenarios; track s) {
|
@for (s of scenarios; track s) {
|
||||||
<option [value]="s">{{ s }}</option>
|
<option [value]="s" [selected]="s === scenario">{{ s }}</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
@@ -140,8 +140,14 @@ export class DebugStateComponent {
|
|||||||
// read per-request in interceptors, so a reload re-runs them and re-fetches decisions.
|
// read per-request in interceptors, so a reload re-runs them and re-fetches decisions.
|
||||||
protected readonly roles = ROLES;
|
protected readonly roles = ROLES;
|
||||||
protected readonly scenarios = SCENARIOS;
|
protected readonly scenarios = SCENARIOS;
|
||||||
protected readonly role = currentRole();
|
// Getters so the dropdowns reflect the CURRENT value whenever the panel is opened
|
||||||
protected readonly scenario = currentScenario();
|
// (not just the value at component construction).
|
||||||
|
protected get role() {
|
||||||
|
return currentRole();
|
||||||
|
}
|
||||||
|
protected get scenario() {
|
||||||
|
return currentScenario();
|
||||||
|
}
|
||||||
|
|
||||||
switchRole(r: Role): void {
|
switchRole(r: Role): void {
|
||||||
setRole(r);
|
setRole(r);
|
||||||
|
|||||||
Reference in New Issue
Block a user