Skip to content

Commit 9a20420

Browse files
committed
[DCV-3510] Guard Prompts/Context settings selects against empty config id
1 parent 2404d50 commit 9a20420

2 files changed

Lines changed: 32 additions & 28 deletions

File tree

webview-ui/src/components/settings/ContextManagementSettings.tsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -510,26 +510,28 @@ export const ContextManagementSettings = ({
510510
{t("settings:contextManagement.condensingThreshold.defaultProfile") ||
511511
"Default (applies to all unconfigured profiles)"}
512512
</SelectItem>
513-
{(listApiConfigMeta || []).map((config) => {
514-
const profileThreshold = profileThresholds[config.id]
515-
const thresholdDisplay =
516-
profileThreshold !== undefined
517-
? profileThreshold === -1
518-
? ` ${t(
519-
"settings:contextManagement.condensingThreshold.usesGlobal",
520-
{
521-
threshold: autoCondenseContextPercent,
522-
},
523-
)}`
524-
: ` (${profileThreshold}%)`
525-
: ""
526-
return (
527-
<SelectItem key={config.id} value={config.id}>
528-
{config.name}
529-
{thresholdDisplay}
530-
</SelectItem>
531-
)
532-
})}
513+
{(listApiConfigMeta || [])
514+
.filter((config) => config.id)
515+
.map((config) => {
516+
const profileThreshold = profileThresholds[config.id]
517+
const thresholdDisplay =
518+
profileThreshold !== undefined
519+
? profileThreshold === -1
520+
? ` ${t(
521+
"settings:contextManagement.condensingThreshold.usesGlobal",
522+
{
523+
threshold: autoCondenseContextPercent,
524+
},
525+
)}`
526+
: ` (${profileThreshold}%)`
527+
: ""
528+
return (
529+
<SelectItem key={config.id} value={config.id}>
530+
{config.name}
531+
{thresholdDisplay}
532+
</SelectItem>
533+
)
534+
})}
533535
</SelectContent>
534536
</Select>
535537
</div>

webview-ui/src/components/settings/PromptsSettings.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,16 @@ const PromptsSettings = ({
182182
<SelectItem value="-">
183183
{t("prompts:supportPrompts.enhance.useCurrentConfig")}
184184
</SelectItem>
185-
{(listApiConfigMeta || []).map((config) => (
186-
<SelectItem
187-
key={config.id}
188-
value={config.id}
189-
data-testid={`${config.id}-option`}>
190-
{config.name}
191-
</SelectItem>
192-
))}
185+
{(listApiConfigMeta || [])
186+
.filter((config) => config.id)
187+
.map((config) => (
188+
<SelectItem
189+
key={config.id}
190+
value={config.id}
191+
data-testid={`${config.id}-option`}>
192+
{config.name}
193+
</SelectItem>
194+
))}
193195
</SelectContent>
194196
</Select>
195197
<div className="text-sm text-vscode-descriptionForeground mt-1">

0 commit comments

Comments
 (0)