From 9dbdc6a72b45929a40df1f8aabfee1fac8b9ef6d Mon Sep 17 00:00:00 2001 From: AustinMroz Date: Fri, 15 Aug 2025 00:34:20 -0500 Subject: [PATCH] Fix inconsistency on bypass from context menu (#4988) 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. --- 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 0198850f8..e38e0796b 100644 --- a/src/services/litegraphService.ts +++ b/src/services/litegraphService.ts @@ -1,5 +1,6 @@ import _ from 'es-toolkit/compat' +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) } })