mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 00:14:15 +00:00
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
This commit is contained in:
1 parent
f947aeb21b
commit
723ce28431
1 file changed
+8
@@ -67,6 +67,13 @@ export function ProfileEditor({ profileName, onDelete }: ProfileEditorProps) {
|
|||||||
setRawJsonEdits(JSON.stringify({ ...currentSettings, env: newEnv }, null, 2));
|
setRawJsonEdits(JSON.stringify({ ...currentSettings, env: newEnv }, null, 2));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Bulk update multiple env vars at once (avoids race conditions)
|
||||||
|
const updateEnvBulk = (env: Record<string, string>) => {
|
||||||
|
const newEnv = { ...(currentSettings?.env || {}), ...env };
|
||||||
|
setLocalEdits((prev) => ({ ...prev, ...env }));
|
||||||
|
setRawJsonEdits(JSON.stringify({ ...currentSettings, env: newEnv }, null, 2));
|
||||||
|
};
|
||||||
|
|
||||||
const addNewEnvVar = () => {
|
const addNewEnvVar = () => {
|
||||||
if (!newEnvKey.trim()) return;
|
if (!newEnvKey.trim()) return;
|
||||||
const key = newEnvKey.trim();
|
const key = newEnvKey.trim();
|
||||||
@@ -179,6 +186,7 @@ export function ProfileEditor({ profileName, onDelete }: ProfileEditorProps) {
|
|||||||
onNewEnvKeyChange={setNewEnvKey}
|
onNewEnvKeyChange={setNewEnvKey}
|
||||||
onNewEnvValueChange={setNewEnvValue}
|
onNewEnvValueChange={setNewEnvValue}
|
||||||
onEnvValueChange={updateEnvValue}
|
onEnvValueChange={updateEnvValue}
|
||||||
|
onEnvBulkChange={updateEnvBulk}
|
||||||
onAddEnvVar={addNewEnvVar}
|
onAddEnvVar={addNewEnvVar}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user