Fix exposed controls silently reverting: autosave snapshot taken before models sync

Reported as 'exposed Bypass toggle says disabled but the node's own checkbox
is checked (i2v still bypassed)'. Root cause in Store.commit(): the project
snapshot was deep-copied BEFORE _syncEditorStateToProject() ran, and only
scene_renders/scene_ghosts were backfilled afterwards — snapshot.models kept
the models config from the PREVIOUS sync. So after any exposed-control edit
(bypass, node input, or link — all saved via the /models endpoint), the next
project autosave uploaded the stale models copy inside the project body and
overwrote p.models on the server. The exposed control kept showing the local
value, the Models window fetched the server truth, and generation used the
server value — the exposed edit never took effect.

Fix: sync editor state into the project BEFORE taking the snapshot (the
backfill lines become redundant and are gone). Verified live against local
ComfyUI both ways: uncheck the exposed bypass → scene edit → autosave →
server models stay bypassed:false; toggle back on via the Models window's
save+event path → another autosave → server stays bypassed:true. 160
movie_editor tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
digital-garbage
2026-07-13 09:52:49 +03:00
co-authored by Claude Fable 5
parent dcfc610684
commit c81ccdaf41
+5 -3
View File
@@ -841,10 +841,12 @@
if (_commitPromise) { _commitQueued = true; return _commitPromise; }
const skipPreviewRefresh = !!opts.skipPreviewRefresh;
_commitPromise = (async () => {
const snapshot = JSON.parse(JSON.stringify(state.project));
// Sync BEFORE snapshotting: the snapshot is what gets uploaded, and a snapshot taken
// first carries the models config (and renders/ghosts) from the PREVIOUS sync — every
// autosave then silently reverted exposed-control edits (bypass/input/link changes
// saved via /models) by overwriting p.models on the server with the stale copy.
_syncEditorStateToProject();
snapshot.scene_renders = state.project.scene_renders;
snapshot.scene_ghosts = state.project.scene_ghosts;
const snapshot = JSON.parse(JSON.stringify(state.project));
const previewKeyBefore = _promptPreviewKey(snapshot);
const selBefore = JSON.stringify(state.selectedSceneIds || []);
const metaBefore = { name: snapshot.name, scene_count: (snapshot.scenes || []).length };