Skip to content

Commit ff3eb2b

Browse files
committed
Don’t populate the custom duration field when timePeriods are selected
1 parent c0bfc95 commit ff3eb2b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

apps/webapp/app/components/runs/v3/SharedFilters.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,16 @@ export function TimeFilter() {
290290
);
291291
}
292292

293-
// Get initial custom duration state from a period string
293+
// Get initial custom duration state from a period string (only if it's not a preset)
294294
function getInitialCustomDuration(period?: string): { value: string; unit: string } {
295295
if (period) {
296-
const parsed = parsePeriodString(period);
297-
if (parsed) {
298-
return { value: parsed.value.toString(), unit: parsed.unit };
296+
// Don't populate custom field if it's a preset period
297+
const isPreset = timePeriods.some((p) => p.value === period);
298+
if (!isPreset) {
299+
const parsed = parsePeriodString(period);
300+
if (parsed) {
301+
return { value: parsed.value.toString(), unit: parsed.unit };
302+
}
299303
}
300304
}
301305
return { value: "", unit: "m" };

0 commit comments

Comments
 (0)