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">
|
||||
<label
|
||||
>role
|
||||
<select [value]="role" (change)="switchRole($any($event.target).value)">
|
||||
<select (change)="switchRole($any($event.target).value)">
|
||||
@for (r of roles; track r) {
|
||||
<option [value]="r">{{ r }}</option>
|
||||
<option [value]="r" [selected]="r === role">{{ r }}</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
<label
|
||||
>scenario
|
||||
<select [value]="scenario" (change)="switchScenario($any($event.target).value)">
|
||||
<select (change)="switchScenario($any($event.target).value)">
|
||||
@for (s of scenarios; track s) {
|
||||
<option [value]="s">{{ s }}</option>
|
||||
<option [value]="s" [selected]="s === scenario">{{ s }}</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
@@ -140,8 +140,14 @@ export class DebugStateComponent {
|
||||
// read per-request in interceptors, so a reload re-runs them and re-fetches decisions.
|
||||
protected readonly roles = ROLES;
|
||||
protected readonly scenarios = SCENARIOS;
|
||||
protected readonly role = currentRole();
|
||||
protected readonly scenario = currentScenario();
|
||||
// Getters so the dropdowns reflect the CURRENT value whenever the panel is opened
|
||||
// (not just the value at component construction).
|
||||
protected get role() {
|
||||
return currentRole();
|
||||
}
|
||||
protected get scenario() {
|
||||
return currentScenario();
|
||||
}
|
||||
|
||||
switchRole(r: Role): void {
|
||||
setRole(r);
|
||||
|
||||
Reference in New Issue
Block a user