From 263f52f539aa1ae3bc652878e8b5b539ec79030d Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Fri, 15 Aug 2025 14:02:38 +0800 Subject: [PATCH] Fix inconsistency on bypass from context menu (#4988) (#4997) When a node is bypassed from the selection toolbox or by pressing a keybind for bypass, it will also recursively bypass the contents of a subgraph. This effect was not applied when clicking the bypass button from the context menu. The context menu option has been updated to perform the same action as the others so that behaviour is consistent. Co-authored-by: AustinMroz --- src/services/litegraphService.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/services/litegraphService.ts b/src/services/litegraphService.ts index b05c7e522..ee8767465 100644 --- a/src/services/litegraphService.ts +++ b/src/services/litegraphService.ts @@ -1,5 +1,6 @@ import _ from 'lodash' +import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems' import { useNodeAnimatedImage } from '@/composables/node/useNodeAnimatedImage' import { useNodeCanvasImagePreview } from '@/composables/node/useNodeCanvasImagePreview' import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage' @@ -63,6 +64,7 @@ export const useLitegraphService = () => { const toastStore = useToastStore() const widgetStore = useWidgetStore() const canvasStore = useCanvasStore() + const { toggleSelectedNodesMode } = useSelectedLiteGraphItems() // TODO: Dedupe `registerNodeDef`; this should remain synchronous. function registerSubgraphNodeDef( @@ -762,15 +764,8 @@ export const useLitegraphService = () => { options.push({ content: 'Bypass', callback: () => { - const mode = - this.mode === LGraphEventMode.BYPASS - ? LGraphEventMode.ALWAYS - : LGraphEventMode.BYPASS - for (const item of app.canvas.selectedItems) { - if (item instanceof LGraphNode) item.mode = mode - } - // @ts-expect-error fixme ts strict error - this.graph.change() + toggleSelectedNodesMode(LGraphEventMode.BYPASS) + app.canvas.setDirty(true, true) } })