Skip to content

Commit a385d27

Browse files
committed
fix: address bot review feedback for search score threshold slider
- Import SEARCH_MIN_SCORE constant to avoid magic number duplication - Replace logical OR (||) with nullish coalescing (??) for numeric defaults to properly handle 0 values - Add aria-label attribute to slider for screen reader accessibility Fixes issues identified by GitHub Copilot and Ellipsis bots in PR #5041
1 parent 5d5ae74 commit a385d27

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Trans } from "react-i18next"
77
import { CodebaseIndexConfig, CodebaseIndexModels, ProviderSettings } from "@roo-code/types"
88

99
import { EmbedderProvider } from "@roo/embeddingModels"
10+
import { SEARCH_MIN_SCORE } from "../../../../src/services/code-index/constants"
1011

1112
import { vscode } from "@src/utils/vscode"
1213
import { useAppTranslation } from "@src/i18n/TranslationContext"
@@ -462,17 +463,18 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
462463
min={0}
463464
max={1}
464465
step={0.05}
465-
value={[codebaseIndexConfig.codebaseIndexSearchMinScore || 0.4]}
466+
value={[codebaseIndexConfig.codebaseIndexSearchMinScore ?? SEARCH_MIN_SCORE]}
466467
onValueChange={([value]) =>
467468
setCachedStateField("codebaseIndexConfig", {
468469
...codebaseIndexConfig,
469470
codebaseIndexSearchMinScore: value,
470471
})
471472
}
472473
data-testid="search-min-score-slider"
474+
aria-label={t("settings:codeIndex.searchMinScoreLabel")}
473475
/>
474476
<span className="w-10">
475-
{(codebaseIndexConfig.codebaseIndexSearchMinScore || 0.4).toFixed(2)}
477+
{(codebaseIndexConfig.codebaseIndexSearchMinScore ?? SEARCH_MIN_SCORE).toFixed(2)}
476478
</span>
477479
<TooltipProvider>
478480
<Tooltip>
@@ -483,7 +485,7 @@ export const CodeIndexSettings: React.FC<CodeIndexSettingsProps> = ({
483485
onClick={() =>
484486
setCachedStateField("codebaseIndexConfig", {
485487
...codebaseIndexConfig,
486-
codebaseIndexSearchMinScore: 0.4,
488+
codebaseIndexSearchMinScore: SEARCH_MIN_SCORE,
487489
})
488490
}
489491
className="h-8 w-8 p-0"

0 commit comments

Comments
 (0)