Skip to content

Commit 4eb855b

Browse files
only21milclaude
andcommitted
fix(web): Source Control's Git fetch interval saves when editing ends
Source Control edits the same automaticGitFetchInterval as the Background activity dialog, but still saved it on every keystroke. It now uses IntervalSecondsField, which takes an optional input label so the field keeps its accessible name. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 6694d84 commit 4eb855b

2 files changed

Lines changed: 10 additions & 29 deletions

File tree

‎apps/web/src/components/settings/IntervalSecondsField.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import { normalizeIntervalSeconds } from "./SettingsPanels.logic";
1414
*/
1515
export function IntervalSecondsField({
1616
label,
17+
inputLabel = `${label.charAt(0).toUpperCase()}${label.slice(1)} in seconds`,
1718
value,
1819
min,
1920
step,
2021
onCommit,
2122
}: {
2223
label: string;
24+
inputLabel?: string;
2325
value: number;
2426
min: number;
2527
step: number;
@@ -52,9 +54,7 @@ export function IntervalSecondsField({
5254
>
5355
<NumberFieldGroup>
5456
<NumberFieldDecrement aria-label={`Decrease ${label}`} />
55-
<NumberFieldInput
56-
aria-label={`${label.charAt(0).toUpperCase()}${label.slice(1)} in seconds`}
57-
/>
57+
<NumberFieldInput aria-label={inputLabel} />
5858
<NumberFieldIncrement aria-label={`Increase ${label}`} />
5959
</NumberFieldGroup>
6060
</NumberField>

‎apps/web/src/components/settings/SourceControlSettings.tsx‎

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { useScopedSettings, useUpdateScopedSettings } from "./useScopedSettings";
2121
import { useSettingsScope } from "./SettingsScopeContext";
2222
import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
23+
import { IntervalSecondsField } from "./IntervalSecondsField";
2324
import { cn } from "../../lib/utils";
2425
import { useEnvironmentQuery } from "../../state/query";
2526
import { sourceControlEnvironment } from "../../state/sourceControl";
@@ -35,13 +36,6 @@ import {
3536
EmptyTitle,
3637
} from "../ui/empty";
3738
import { Skeleton } from "../ui/skeleton";
38-
import {
39-
NumberField,
40-
NumberFieldDecrement,
41-
NumberFieldGroup,
42-
NumberFieldIncrement,
43-
NumberFieldInput,
44-
} from "../ui/number-field";
4539
import { Switch } from "../ui/switch";
4640
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
4741

@@ -86,13 +80,6 @@ function durationToSeconds(duration: Duration.Duration): number {
8680
return Math.round(Duration.toMillis(duration) / 1_000);
8781
}
8882

89-
function normalizeFetchIntervalSeconds(value: number | null): number {
90-
if (value === null || !Number.isFinite(value)) {
91-
return 0;
92-
}
93-
return Math.max(0, Math.round(value));
94-
}
95-
9683
function backgroundActivityOverrideSettings(
9784
current: BackgroundActivitySettings,
9885
overrides: BackgroundActivityOverridePatch,
@@ -400,26 +387,20 @@ function GitFetchIntervalSettings() {
400387
</p>
401388
</div>
402389
<div className="flex shrink-0 items-center gap-2">
403-
<NumberField
390+
<IntervalSecondsField
391+
label="fetch interval"
392+
inputLabel="Automatic Git fetch interval in seconds"
404393
value={automaticGitFetchIntervalSeconds}
405394
min={0}
406395
step={GIT_FETCH_INTERVAL_STEP_SECONDS}
407-
size="sm"
408-
className="w-32"
409-
onValueChange={(value) =>
396+
onCommit={(seconds) =>
410397
updateSettings(
411398
backgroundActivityOverrideSettings(settings.backgroundActivity, {
412-
automaticGitFetchInterval: Duration.seconds(normalizeFetchIntervalSeconds(value)),
399+
automaticGitFetchInterval: Duration.seconds(seconds),
413400
}),
414401
)
415402
}
416-
>
417-
<NumberFieldGroup>
418-
<NumberFieldDecrement aria-label="Decrease fetch interval" />
419-
<NumberFieldInput aria-label="Automatic Git fetch interval in seconds" />
420-
<NumberFieldIncrement aria-label="Increase fetch interval" />
421-
</NumberFieldGroup>
422-
</NumberField>
403+
/>
423404
<span className="text-xs text-muted-foreground">seconds</span>
424405
</div>
425406
</div>

0 commit comments

Comments
 (0)