From 98d7256da47a63e91f692c843155b7fcb3626afe Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 29 Apr 2025 19:59:49 -0400 Subject: [PATCH] Remove refresh button when all nodes are selected (#3690) --- browser_tests/tests/selectionToolbox.spec.ts | 12 ------------ src/composables/useRefreshableSelection.ts | 18 +++--------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/browser_tests/tests/selectionToolbox.spec.ts b/browser_tests/tests/selectionToolbox.spec.ts index 35f3a7eb5..203dd3506 100644 --- a/browser_tests/tests/selectionToolbox.spec.ts +++ b/browser_tests/tests/selectionToolbox.spec.ts @@ -99,18 +99,6 @@ test.describe('Selection Toolbox', () => { ).not.toBeVisible() }) - test('displays refresh button in toolbox when all nodes are selected', async ({ - comfyPage - }) => { - // Select all nodes - await comfyPage.page.focus('canvas') - await comfyPage.page.keyboard.press('Control+A') - - await expect( - comfyPage.page.locator('.selection-toolbox .pi-refresh') - ).toBeVisible() - }) - test('displays bypass button in toolbox when nodes are selected', async ({ comfyPage }) => { diff --git a/src/composables/useRefreshableSelection.ts b/src/composables/useRefreshableSelection.ts index 26fa7366f..518d120f2 100644 --- a/src/composables/useRefreshableSelection.ts +++ b/src/composables/useRefreshableSelection.ts @@ -1,8 +1,6 @@ -import type { LGraphNode } from '@comfyorg/litegraph' -import type { IWidget } from '@comfyorg/litegraph' +import type { IWidget, LGraphNode } from '@comfyorg/litegraph' import { computed, ref, watchEffect } from 'vue' -import { useCommandStore } from '@/stores/commandStore' import { useCanvasStore } from '@/stores/graphStore' import { isLGraphNode } from '@/utils/litegraphUtil' @@ -20,14 +18,10 @@ const isRefreshableWidget = (widget: IWidget): widget is RefreshableWidget => */ export const useRefreshableSelection = () => { const graphStore = useCanvasStore() - const commandStore = useCommandStore() const selectedNodes = ref([]) - const isAllNodesSelected = ref(false) watchEffect(() => { selectedNodes.value = graphStore.selectedItems.filter(isLGraphNode) - isAllNodesSelected.value = - graphStore.canvas?.graph?.nodes?.every((node) => !!node.selected) ?? false }) const refreshableWidgets = computed(() => @@ -36,18 +30,12 @@ export const useRefreshableSelection = () => { ) ) - const isRefreshable = computed( - () => refreshableWidgets.value.length > 0 || isAllNodesSelected.value - ) + const isRefreshable = computed(() => refreshableWidgets.value.length > 0) async function refreshSelected() { if (!isRefreshable.value) return - if (isAllNodesSelected.value) { - await commandStore.execute('Comfy.RefreshNodeDefinitions') - } else { - await Promise.all(refreshableWidgets.value.map((item) => item.refresh())) - } + await Promise.all(refreshableWidgets.value.map((item) => item.refresh())) } return {