From 9c20945ad4c667a6d69ab93a09c2de19b03033f7 Mon Sep 17 00:00:00 2001 From: Diego Imbert Date: Sun, 6 Sep 2026 08:39:41 +0200 Subject: [PATCH] fix(schedules): report what a write actually left diverging, and adopt what it deployed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The enable/disable request carries the enabled flag alone, but claimed to leave nothing behind — so the host remounted, and a summary or args edit still sitting on the autosave debounce went with it. It now reports the form's real divergence from the baseline it just moved. A save also left `edit` and `draftOnly` to the remount, which is exactly what a kept edit skips: a draft-only schedule created while the user typed stayed in draft-only mode, with its path still editable and its next save a create. They follow the write that deployed it instead. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01KcyBRxE8j3ujCYkum9KrC4 --- .../triggers/schedules/ScheduleEditorInner.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte b/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte index 5b81470a93..a553480f51 100644 --- a/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte +++ b/frontend/src/lib/components/triggers/schedules/ScheduleEditorInner.svelte @@ -632,6 +632,11 @@ // — and the host must not remount over it, which is the only thing that can // tell it so. const keptEdit = !draftValuesEqual(getScheduleCfg(), scheduleCfg) + // The schedule is deployed now, whether it was before or not. Set here rather + // than left to the remount, which a kept edit skips: they decide whether the + // next save updates or creates, and whether a discard removes the item. + edit = true + draftOnly = false settleDraftAfterWrite( 'trigger_schedule', scheduleCfg, @@ -758,7 +763,9 @@ sendUserToast(`${nEnabled ? 'enabled' : 'disabled'} schedule ${path}`) // Deployed state moved, so the baseline the banner compares against does too. if (initialConfig) initialConfig.enabled = nEnabled - onUpdate?.(path, path, ws, false) + // This request carried the enabled flag alone: anything else the form has + // diverged into is an edit of the user's, which a remount would drop. + onUpdate?.(path, path, ws, !draftValuesEqual(getScheduleCfg(), initialConfig)) } }