mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(web): focus failing agent's fields when Configure is clicked from a different agent tab
Address Looper non-blocking review on PR #2022 (commit6796acc41, discussion_r3329925123): When the Settings dialog had Claude selected and the user clicked "Configure" on a misconfigured CodeBuddy card, `configErrorAgentId` was added to the cliEnvFields filter — but the result still listed the *currently selected* agent's fields first. The first-field focus logic (`index === 0`) then landed on `CLAUDE_CONFIG_DIR` instead of the CodeBuddy field the user actually came to fix. When `configErrorAgentId` is set AND it's a different agent than `cfg.agentId`, partition the matched fields so the failing agent's fields come first, with the selected agent's fields after. The auto-focus / scroll target (index === 0) now points at the agent the user just clicked Configure for. Verified locally: - `pnpm --filter @open-design/web typecheck` passes - `pnpm --filter @open-design/web test tests/components/SettingsDialog.test.ts` 44/45 passed (the remaining failure — "still starts a manual Orbit run when saving media credentials fails" — is pre-existing on the merge commit6796acc41and is unrelated to the CodeBuddy adapter)
This commit is contained in:
parent
6796acc41d
commit
98391a14f5
1 changed files with 18 additions and 3 deletions
|
|
@ -3223,9 +3223,24 @@ export function SettingsDialog({
|
|||
users no longer wonder "are these fields I forgot to
|
||||
fill in?".
|
||||
*/
|
||||
const cliEnvFields = AGENT_CLI_ENV_FIELDS.filter(
|
||||
(field) => field.agentId === cfg.agentId || field.agentId === configErrorAgentId,
|
||||
);
|
||||
const cliEnvFields = (() => {
|
||||
const matches = AGENT_CLI_ENV_FIELDS.filter(
|
||||
(field) => field.agentId === cfg.agentId || field.agentId === configErrorAgentId,
|
||||
);
|
||||
// When the recovery flow is active for an agent OTHER than
|
||||
// the currently selected one, surface that agent's fields
|
||||
// first so the auto-focus target (index === 0) is the
|
||||
// misconfigured field the user just clicked Configure for —
|
||||
// not the selected agent's first advanced field, which they
|
||||
// did not ask to edit.
|
||||
if (configErrorAgentId && configErrorAgentId !== cfg.agentId) {
|
||||
return [
|
||||
...matches.filter((f) => f.agentId === configErrorAgentId),
|
||||
...matches.filter((f) => f.agentId !== configErrorAgentId),
|
||||
];
|
||||
}
|
||||
return matches;
|
||||
})();
|
||||
if (cliEnvFields.length === 0) return null;
|
||||
return (
|
||||
<details
|
||||
|
|
|
|||
Loading…
Reference in a new issue