From a7d0c13f9aee99fee41635f2b1befa52e8ca321b Mon Sep 17 00:00:00 2001 From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com> Date: Mon, 15 Jun 2026 18:58:50 -0400 Subject: [PATCH] fix: avoid auto-applying OpenCode config on dropdown selection (#275) --- .../settings/OpenCodeConfigManager.tsx | 132 +++++++++++------- 1 file changed, 80 insertions(+), 52 deletions(-) diff --git a/frontend/src/components/settings/OpenCodeConfigManager.tsx b/frontend/src/components/settings/OpenCodeConfigManager.tsx index 99b809bb..793934da 100644 --- a/frontend/src/components/settings/OpenCodeConfigManager.tsx +++ b/frontend/src/components/settings/OpenCodeConfigManager.tsx @@ -1,11 +1,12 @@ import { useState, useEffect, useRef } from 'react' import { cn } from '@/lib/utils' -import { Loader2, Plus, Trash2, Edit, StarOff, Download, RotateCcw, FileText, ArrowUpCircle, History, ChevronDown } from 'lucide-react' +import { Loader2, Plus, Trash2, Edit, Download, RotateCcw, FileText, ArrowUpCircle, History, ChevronDown } from 'lucide-react' import { Button } from '@/components/ui/button' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Label } from '@/components/ui/label' import { Badge } from '@/components/ui/badge' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select' +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { DeleteDialog } from '@/components/ui/delete-dialog' import { CreateConfigDialog } from './CreateConfigDialog' import { OpenCodeConfigEditor } from './OpenCodeConfigEditor' @@ -638,20 +639,28 @@ export function OpenCodeConfigManager({ hideHealthStatus = false }: OpenCodeConf value={activeConfigName} onValueChange={(value) => { setActiveConfigName(value) - const next = configs.find((c) => c.name === value) - if (next && !next.isDefault) { - void setDefaultConfig(next) - } }} > - + + {activeConfig && ( + <> + {activeConfig.name} + {activeConfig.isDefault && ( + (Active) + )} + {!activeConfig.isValid && ' (Invalid)'} + > + )} + {configs.map((config) => ( {config.name} - {config.isDefault && ' (Current)'} + {config.isDefault && ( + (Active) + )} {!config.isValid && ' (Invalid)'} ))} @@ -659,55 +668,74 @@ export function OpenCodeConfigManager({ hideHealthStatus = false }: OpenCodeConf - {activeConfig?.isDefault && ( - - Current - - )} {activeConfig && !activeConfig.isValid && ( Invalid Config )} - - activeConfig && downloadConfig(activeConfig)} - > - - - activeConfig && startEdit(activeConfig)} - > - - - activeConfig && setDefaultConfig(activeConfig)} - > - - - activeConfig && setDeleteConfirmConfig(activeConfig)} - > - - - setIsCreateDialogOpen(true)}> - - New Config - - + + + + + activeConfig && downloadConfig(activeConfig)} + > + + + + Download + + + + activeConfig && startEdit(activeConfig)} + > + + + + Edit + + {!activeConfig?.isDefault && ( + + + activeConfig && setDefaultConfig(activeConfig)} + > + Apply + + + Apply as default + + )} + + + activeConfig && setDeleteConfirmConfig(activeConfig)} + > + + + + Delete + + setIsCreateDialogOpen(true)}> + + New Config + + + {activeConfig && ( @@ -781,7 +809,7 @@ export function OpenCodeConfigManager({ hideHealthStatus = false }: OpenCodeConf Select Configuration to Edit - { const config = configs.find(c => c.name === value) setSelectedConfig(config || null)