feat: automatically select new or duplicated schedules (#583) (#589)

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com>
This commit is contained in:
sjalkote
2025-06-08 22:39:46 -05:00
committed by GitHub
parent 65bfb1d129
commit 2a50f5580d
2 changed files with 7 additions and 0 deletions

View File

@@ -37,6 +37,9 @@ export default async function createSchedule(scheduleName: string) {
await UserScheduleStore.set('schedules', schedules);
// Automatically switch to the new schedule
await UserScheduleStore.set('activeIndex', schedules.length - 1);
// If there is only one schedule, set the active index to the new schedule
if (schedules.length <= 1) {
await UserScheduleStore.set('activeIndex', 0);

View File

@@ -31,5 +31,9 @@ export default async function duplicateSchedule(scheduleId: string): Promise<str
} satisfies typeof schedule);
await UserScheduleStore.set('schedules', schedules);
// Automatically switch to the duplicated schedule
await UserScheduleStore.set('activeIndex', scheduleIndex + 1);
return undefined;
}