From 6648d4b9d646a459f6bc265a6e5d396db02468b3 Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Tue, 30 Jun 2026 00:18:38 +0200 Subject: [PATCH] Remove global Alt+Arrow keybinding; guard post-switch seeding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global Alt+Left/Right keydown handler called preventDefault() on the browser's Back/Forward shortcut for the whole document — the most likely cause of "can't switch workflow" after the previous deploy, and a poor default regardless. Remove the handler (stepToSnapshot remains for a future conflict-free binding or a timeline button). Also wrap the post-switch baseline seeding in try/catch so any failure there can never propagate into ComfyUI's openWorkflow action and block a workflow switch. Co-Authored-By: Claude Opus 4.8 --- js/snapshot_manager.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/js/snapshot_manager.js b/js/snapshot_manager.js index 28e92be..16a6e23 100644 --- a/js/snapshot_manager.js +++ b/js/snapshot_manager.js @@ -4411,12 +4411,16 @@ if (window.__COMFYUI_FRONTEND_VERSION__) { activeBranchSelections.clear(); // Seed active ring for the new workflow tab const newKey = getWorkflowKey(); - // Re-seed the dedup/change-detection baseline for the new - // tab and suppress auto-capture briefly, so the graphChanged - // fired by loading this workflow doesn't spawn a redundant - // "Auto" snapshot of a workflow the user only just opened. - seedWorkflowBaseline(newKey); - suppressAutoCapture(SWITCH_GUARD_MS); + // Suppress auto-capture briefly so the graphChanged fired + // by loading this workflow doesn't spawn a redundant "Auto" + // snapshot of a workflow the user only just opened. Guard + // everything so a failure here can never break the switch. + try { + suppressAutoCapture(SWITCH_GUARD_MS); + seedWorkflowBaseline(newKey); + } catch (err) { + console.warn(`[${EXTENSION_NAME}] post-switch seeding failed:`, err); + } trackSessionWorkflow(newKey); db_getAllForWorkflow(newKey).then(recs => { if (recs.length > 0 && !lastCapturedIdMap.has(newKey)) { @@ -4451,16 +4455,9 @@ if (window.__COMFYUI_FRONTEND_VERSION__) { } }); - // Alt+Left / Alt+Right step non-destructively through snapshot history - // (Fusion-360 "roll the history marker" feel — jump back/forth freely). - document.addEventListener("keydown", (e) => { - if (!e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return; - if (e.key !== "ArrowLeft" && e.key !== "ArrowRight") return; - const t = e.target; - if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable)) return; - e.preventDefault(); - stepToSnapshot(e.key === "ArrowLeft" ? -1 : 1).catch(() => {}); - }); + // (Keyboard step-navigation removed: a global Alt+Left/Right handler + // collides with the browser's Back/Forward. stepToSnapshot() remains + // for a future, conflict-free binding or a timeline button.) // Build the timeline bar on the canvas buildTimeline();