mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-22 00:03:35 +00:00
fix(schedules): adopt the enabled state a create deploys
Creating a schedule sends `enabled: true` whatever the form held, so a draft-only save left the form and its new baseline recording a state the server does not have — visible once a kept edit skips the remount that used to hide it. Also moves the settle comment in VariableEditor back onto its call. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KcyBRxE8j3ujCYkum9KrC4
This commit is contained in:
co-authored by
Claude Opus 5
parent
ba654d594f
commit
fcb25ce416
@@ -338,16 +338,16 @@
|
||||
initialStates[ws] = s
|
||||
existedInitially[ws] = true
|
||||
}
|
||||
// The just-saved state is the new deployed baseline; `settleDraftAfterWrite`
|
||||
// resets the handle to it via `discard` (not `remove` — blanking the cell
|
||||
// to `undefined` reads as dirty), and keeps an edit made mid-request. Each
|
||||
// workspace settles against the path its own write used, not the reported one.
|
||||
if (ws === fromWs) actingCommitted = true
|
||||
// Per workspace, as each write lands. Each carries its own workspace and
|
||||
// the path it wrote there, so a linked workspace's rename moves the tabs
|
||||
// acting on it and no others — and a workspace written before a later one
|
||||
// threw is still reported, because it is deployed.
|
||||
onSaved?.(s.path, from, ws)
|
||||
// The just-saved state is the new deployed baseline; this resets the handle
|
||||
// to it via `discard` (not `remove` — blanking the cell to `undefined` reads
|
||||
// as dirty) and keeps an edit made mid-request. Each workspace settles
|
||||
// against the path its own write used, not the reported one.
|
||||
settleDraftAfterWrite('variable', s, states[ws]?.draft, from ?? '', s.path, {
|
||||
workspace: ws
|
||||
})
|
||||
|
||||
@@ -621,9 +621,17 @@
|
||||
// `labels` alias live state, so an edit made while the request is in flight
|
||||
// would read back as part of what was sent.
|
||||
const scheduleCfg = $state.snapshot(getScheduleCfg()) as Record<string, any>
|
||||
const wasCreate = !edit
|
||||
deploymentLoading = true
|
||||
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.
|
||||
if (wasCreate) {
|
||||
enabled = true
|
||||
scheduleCfg.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
|
||||
// re-read over an edit made then — which `settleDraftAfterWrite` keeps.
|
||||
|
||||
Reference in New Issue
Block a user