Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): keep Schedule Run button enabled when editing schedule name (#13481)

Abhimanyu Yadav313fcbae3367
diff --git a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/ModalScheduleSection/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/ModalScheduleSection/helpers.ts
index 6fb89ac3f8..2ab489784c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/ModalScheduleSection/helpers.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/NewAgentLibraryView/components/modals/ScheduleAgentModal/components/ModalScheduleSection/helpers.ts
@@ -4,7 +4,7 @@ export const timeRegex = /^([01]?\d|2[0-3]):([0-5]\d)$/;
export const scheduleFormSchema = z.object({
scheduleName: z.string().trim().min(1, "Schedule name is required"),
- time: z.string().trim().regex(timeRegex, "Use HH:MM (24h)"),
+ time: z.string().trim().regex(timeRegex, "Use HH:MM (24h)").optional(),
});
export type ScheduleFormValues = z.infer<typeof scheduleFormSchema>;
@@ -14,7 +14,7 @@ export function validateSchedule(
): Partial<Record<keyof ScheduleFormValues, string>> {
const result = scheduleFormSchema.safeParse({
scheduleName: values.scheduleName ?? "",
- time: values.time ?? "",
+ ...(values.time !== undefined ? { time: values.time } : {}),
});
if (result.success) return {};