diff --git a/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx b/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx index e203e4cf75..fb1f0dc718 100644 --- a/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx +++ b/webview-ui/src/components/settings/ConcurrentFileReadsExperiment.tsx @@ -55,11 +55,11 @@ export const ConcurrentFileReadsExperiment = ({ min={2} max={100} step={1} - value={[maxConcurrentFileReads]} + value={[Math.max(2, maxConcurrentFileReads)]} onValueChange={([value]) => onMaxConcurrentFileReadsChange(value)} data-testid="max-concurrent-file-reads-slider" /> - {maxConcurrentFileReads} + {Math.max(2, maxConcurrentFileReads)} diff --git a/webview-ui/src/components/settings/__tests__/ConcurrentFileReadsExperiment.test.tsx b/webview-ui/src/components/settings/__tests__/ConcurrentFileReadsExperiment.test.tsx index 0c302d006e..590a072ee9 100644 --- a/webview-ui/src/components/settings/__tests__/ConcurrentFileReadsExperiment.test.tsx +++ b/webview-ui/src/components/settings/__tests__/ConcurrentFileReadsExperiment.test.tsx @@ -138,4 +138,35 @@ describe("ConcurrentFileReadsExperiment", () => { // Verify new value is displayed expect(screen.getByText("50")).toBeInTheDocument() }) + + it("should display minimum value of 2 when maxConcurrentFileReads is less than 2", () => { + render( + , + ) + + // Should display 2 (minimum value) instead of 1 + expect(screen.getByText("2")).toBeInTheDocument() + }) + + it("should set maxConcurrentFileReads to 15 when enabling with value of 0", () => { + render( + , + ) + + const checkbox = screen.getByTestId("concurrent-file-reads-checkbox") + fireEvent.click(checkbox) + + expect(mockOnEnabledChange).toHaveBeenCalledWith(true) + expect(mockOnMaxConcurrentFileReadsChange).toHaveBeenCalledWith(15) + }) })