The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(ui): prevent dropdown snap-back when switching env var to Secret
Cody (Radius Red)92e03ac4e3c7
diff --git a/ui/src/components/AgentConfigForm.tsx b/ui/src/components/AgentConfigForm.tsxindex 7d5c4f4582..c3c9bdfa6f 100644--- a/ui/src/components/AgentConfigForm.tsx+++ b/ui/src/components/AgentConfigForm.tsx@@ -1155,9 +1155,17 @@ function EnvVarEditor({const [rows, setRows] = useState<Row[]>(() => toRows(value));const [sealError, setSealError] = useState<string | null>(null);const valueRef = useRef(value);+ const emittingRef = useRef(false);- // Sync when value identity changes (overlay reset after save)+ // Sync when value identity changes (overlay reset after save).+ // Skip re-sync when the change was triggered by our own emit() to avoid+ // reverting local row state (e.g. a secret-transition dropdown choice).useEffect(() => {+ if (emittingRef.current) {+ emittingRef.current = false;+ valueRef.current = value;+ return;+ }if (value !== valueRef.current) {valueRef.current = value;setRows(toRows(value));@@ -1173,13 +1181,15 @@ function EnvVarEditor({if (row.secretId) {rec[k] = { type: "secret_ref", secretId: row.secretId, version: "latest" };} else {- // Preserve as plain during transition to avoid data loss+ // Row is transitioning to secret but user hasn't picked one yet.+ // Preserve the plain value so it isn't silently dropped.rec[k] = { type: "plain", value: row.plainValue };}} else {rec[k] = { type: "plain", value: row.plainValue };}}+ emittingRef.current = true;onChange(Object.keys(rec).length > 0 ? rec : undefined);}