Skip to content

Commit 98d7256

Browse files
authored
Remove refresh button when all nodes are selected (#3690)
1 parent 4828af9 commit 98d7256

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

browser_tests/tests/selectionToolbox.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,6 @@ test.describe('Selection Toolbox', () => {
9999
).not.toBeVisible()
100100
})
101101

102-
test('displays refresh button in toolbox when all nodes are selected', async ({
103-
comfyPage
104-
}) => {
105-
// Select all nodes
106-
await comfyPage.page.focus('canvas')
107-
await comfyPage.page.keyboard.press('Control+A')
108-
109-
await expect(
110-
comfyPage.page.locator('.selection-toolbox .pi-refresh')
111-
).toBeVisible()
112-
})
113-
114102
test('displays bypass button in toolbox when nodes are selected', async ({
115103
comfyPage
116104
}) => {

src/composables/useRefreshableSelection.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import type { LGraphNode } from '@comfyorg/litegraph'
2-
import type { IWidget } from '@comfyorg/litegraph'
1+
import type { IWidget, LGraphNode } from '@comfyorg/litegraph'
32
import { computed, ref, watchEffect } from 'vue'
43

5-
import { useCommandStore } from '@/stores/commandStore'
64
import { useCanvasStore } from '@/stores/graphStore'
75
import { isLGraphNode } from '@/utils/litegraphUtil'
86

@@ -20,14 +18,10 @@ const isRefreshableWidget = (widget: IWidget): widget is RefreshableWidget =>
2018
*/
2119
export const useRefreshableSelection = () => {
2220
const graphStore = useCanvasStore()
23-
const commandStore = useCommandStore()
2421
const selectedNodes = ref<LGraphNode[]>([])
25-
const isAllNodesSelected = ref(false)
2622

2723
watchEffect(() => {
2824
selectedNodes.value = graphStore.selectedItems.filter(isLGraphNode)
29-
isAllNodesSelected.value =
30-
graphStore.canvas?.graph?.nodes?.every((node) => !!node.selected) ?? false
3125
})
3226

3327
const refreshableWidgets = computed(() =>
@@ -36,18 +30,12 @@ export const useRefreshableSelection = () => {
3630
)
3731
)
3832

39-
const isRefreshable = computed(
40-
() => refreshableWidgets.value.length > 0 || isAllNodesSelected.value
41-
)
33+
const isRefreshable = computed(() => refreshableWidgets.value.length > 0)
4234

4335
async function refreshSelected() {
4436
if (!isRefreshable.value) return
4537

46-
if (isAllNodesSelected.value) {
47-
await commandStore.execute('Comfy.RefreshNodeDefinitions')
48-
} else {
49-
await Promise.all(refreshableWidgets.value.map((item) => item.refresh()))
50-
}
38+
await Promise.all(refreshableWidgets.value.map((item) => item.refresh()))
5139
}
5240

5341
return {

0 commit comments

Comments
 (0)