Remove global Alt+Arrow keybinding; guard post-switch seeding
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 <noreply@anthropic.com>
This commit is contained in:
+12
-15
@@ -4411,12 +4411,16 @@ if (window.__COMFYUI_FRONTEND_VERSION__) {
|
|||||||
activeBranchSelections.clear();
|
activeBranchSelections.clear();
|
||||||
// Seed active ring for the new workflow tab
|
// Seed active ring for the new workflow tab
|
||||||
const newKey = getWorkflowKey();
|
const newKey = getWorkflowKey();
|
||||||
// Re-seed the dedup/change-detection baseline for the new
|
// Suppress auto-capture briefly so the graphChanged fired
|
||||||
// tab and suppress auto-capture briefly, so the graphChanged
|
// by loading this workflow doesn't spawn a redundant "Auto"
|
||||||
// fired by loading this workflow doesn't spawn a redundant
|
// snapshot of a workflow the user only just opened. Guard
|
||||||
// "Auto" snapshot of a workflow the user only just opened.
|
// everything so a failure here can never break the switch.
|
||||||
seedWorkflowBaseline(newKey);
|
try {
|
||||||
suppressAutoCapture(SWITCH_GUARD_MS);
|
suppressAutoCapture(SWITCH_GUARD_MS);
|
||||||
|
seedWorkflowBaseline(newKey);
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(`[${EXTENSION_NAME}] post-switch seeding failed:`, err);
|
||||||
|
}
|
||||||
trackSessionWorkflow(newKey);
|
trackSessionWorkflow(newKey);
|
||||||
db_getAllForWorkflow(newKey).then(recs => {
|
db_getAllForWorkflow(newKey).then(recs => {
|
||||||
if (recs.length > 0 && !lastCapturedIdMap.has(newKey)) {
|
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
|
// (Keyboard step-navigation removed: a global Alt+Left/Right handler
|
||||||
// (Fusion-360 "roll the history marker" feel — jump back/forth freely).
|
// collides with the browser's Back/Forward. stepToSnapshot() remains
|
||||||
document.addEventListener("keydown", (e) => {
|
// for a future, conflict-free binding or a timeline button.)
|
||||||
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(() => {});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Build the timeline bar on the canvas
|
// Build the timeline bar on the canvas
|
||||||
buildTimeline();
|
buildTimeline();
|
||||||
|
|||||||
Reference in New Issue
Block a user