From 723ce284314272f05b0413c3f9fdd4bcdb298618 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Sat, 20 Dec 2025 23:23:50 -0500 Subject: [PATCH] fix(ui): model selection now updates all tiers correctly - Add updateEnvBulk function for atomic multi-key updates - Pass onEnvBulkChange prop to FriendlyUISection - Fixes race condition where only last tier (haiku) was updated --- ui/src/components/profiles/editor/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/src/components/profiles/editor/index.tsx b/ui/src/components/profiles/editor/index.tsx index c356efd9..01fc8b5b 100644 --- a/ui/src/components/profiles/editor/index.tsx +++ b/ui/src/components/profiles/editor/index.tsx @@ -67,6 +67,13 @@ export function ProfileEditor({ profileName, onDelete }: ProfileEditorProps) { setRawJsonEdits(JSON.stringify({ ...currentSettings, env: newEnv }, null, 2)); }; + // Bulk update multiple env vars at once (avoids race conditions) + const updateEnvBulk = (env: Record) => { + const newEnv = { ...(currentSettings?.env || {}), ...env }; + setLocalEdits((prev) => ({ ...prev, ...env })); + setRawJsonEdits(JSON.stringify({ ...currentSettings, env: newEnv }, null, 2)); + }; + const addNewEnvVar = () => { if (!newEnvKey.trim()) return; const key = newEnvKey.trim(); @@ -179,6 +186,7 @@ export function ProfileEditor({ profileName, onDelete }: ProfileEditorProps) { onNewEnvKeyChange={setNewEnvKey} onNewEnvValueChange={setNewEnvValue} onEnvValueChange={updateEnvValue} + onEnvBulkChange={updateEnvBulk} onAddEnvVar={addNewEnvVar} />