@@ -53,6 +53,9 @@ const validateDescription = (description: string): string | null => {
5353 return null
5454}
5555
56+ // Sentinel value for "Any mode" since Radix Select doesn't allow empty string values
57+ const MODE_ANY = "__any__"
58+
5659export const CreateSkillDialog : React . FC < CreateSkillDialogProps > = ( {
5760 open,
5861 onOpenChange,
@@ -65,7 +68,7 @@ export const CreateSkillDialog: React.FC<CreateSkillDialogProps> = ({
6568 const [ name , setName ] = useState ( "" )
6669 const [ description , setDescription ] = useState ( "" )
6770 const [ source , setSource ] = useState < "global" | "project" > ( hasWorkspace ? "project" : "global" )
68- const [ mode , setMode ] = useState < string > ( "" )
71+ const [ mode , setMode ] = useState < string > ( MODE_ANY )
6972 const [ nameError , setNameError ] = useState < string | null > ( null )
7073 const [ descriptionError , setDescriptionError ] = useState < string | null > ( null )
7174
@@ -87,7 +90,7 @@ export const CreateSkillDialog: React.FC<CreateSkillDialogProps> = ({
8790 setName ( "" )
8891 setDescription ( "" )
8992 setSource ( hasWorkspace ? "project" : "global" )
90- setMode ( "" )
93+ setMode ( MODE_ANY )
9194 setNameError ( null )
9295 setDescriptionError ( null )
9396 } , [ hasWorkspace ] )
@@ -124,12 +127,13 @@ export const CreateSkillDialog: React.FC<CreateSkillDialogProps> = ({
124127 }
125128
126129 // Send message to create skill
130+ // Convert MODE_ANY sentinel value to undefined for the backend
127131 vscode . postMessage ( {
128132 type : "createSkill" ,
129133 skillName : name ,
130134 source,
131135 skillDescription : description ,
132- skillMode : mode || undefined ,
136+ skillMode : mode === MODE_ANY ? undefined : mode ,
133137 } )
134138
135139 // Close dialog and notify parent
@@ -219,7 +223,7 @@ export const CreateSkillDialog: React.FC<CreateSkillDialogProps> = ({
219223 < SelectValue placeholder = { t ( "settings:skills.createDialog.modePlaceholder" ) } />
220224 </ SelectTrigger >
221225 < SelectContent >
222- < SelectItem value = "" > { t ( "settings:skills.createDialog.modeAny" ) } </ SelectItem >
226+ < SelectItem value = { MODE_ANY } > { t ( "settings:skills.createDialog.modeAny" ) } </ SelectItem >
223227 { availableModes . map ( ( m ) => (
224228 < SelectItem key = { m . slug } value = { m . slug } >
225229 { m . name }
0 commit comments