fix(schedules): let the create's enabled state reach the form only if nothing changed it

Adopting it unconditionally overwrote whatever the field held by then, so a
write landing during the request — the chat seeding the cell — was erased before
anything could notice it had, and settled away as if it were the save's own.
What was written still records `true`, since that is what the create sent; the
form follows only while it still holds the value that went with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KcyBRxE8j3ujCYkum9KrC4
This commit is contained in:
Diego Imbert
2026-09-06 09:41:47 +02:00
co-authored by Claude Opus 5
parent fcb25ce416
commit 069d66627d
@@ -626,11 +626,14 @@
const isSaved = await saveScheduleFromCfg(scheduleCfg, edit, wsId!)
if (isSaved) {
// A create deploys the schedule enabled whatever the form said (see
// saveScheduleFromCfg), so both the form and what counts as written adopt it
// — otherwise the baseline below records a state the server does not have.
// saveScheduleFromCfg), so what counts as written records that — otherwise
// the baseline below claims a state the server does not have. The form
// follows only while it still holds what was sent: changed during the
// request, it is a newer edit, and `keptEdit` below is what protects it.
if (wasCreate) {
enabled = true
const sentEnabled = scheduleCfg.enabled
scheduleCfg.enabled = true
if (enabled === sentEnabled) enabled = true
}
// What was sent is the deployed value now. Adopted here rather than by
// remounting: the form stays editable during the write, and a remount would