mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 22:37:32 +00:00
[backport core/1.32] [bugfix] Fix execute button incorrectly disabled on empty workflows (#6775)
Backport of #6774 to `core/1.32` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6775-backport-core-1-32-bugfix-Fix-execute-button-incorrectly-disabled-on-empty-workflows-2b16d73d36508128a87ffc64a8c70184) by [Unito](https://www.unito.io) Co-authored-by: Jin Yi <jin12cc@gmail.com>
This commit is contained in:
@@ -114,7 +114,10 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
|
||||
const getWorkflowPacks = async () => {
|
||||
if (!app.graph) return []
|
||||
const allNodes = collectAllNodes(app.graph)
|
||||
if (!allNodes.length) return []
|
||||
if (!allNodes.length) {
|
||||
workflowPacks.value = []
|
||||
return []
|
||||
}
|
||||
const packs = await Promise.all(allNodes.map(workflowNodeToPack))
|
||||
workflowPacks.value = packs.filter((pack) => pack !== undefined)
|
||||
}
|
||||
|
||||
@@ -277,6 +277,32 @@ describe('useMissingNodes', () => {
|
||||
// Should update missing packs (2 missing since pack-3 is installed)
|
||||
expect(missingNodePacks.value).toHaveLength(2)
|
||||
})
|
||||
|
||||
it('clears missing nodes when switching to empty workflow', async () => {
|
||||
const workflowPacksRef = ref(mockWorkflowPacks)
|
||||
mockUseWorkflowPacks.mockReturnValue({
|
||||
workflowPacks: workflowPacksRef,
|
||||
isLoading: ref(false),
|
||||
error: ref(null),
|
||||
startFetchWorkflowPacks: mockStartFetchWorkflowPacks,
|
||||
isReady: ref(true),
|
||||
filterWorkflowPack: vi.fn()
|
||||
})
|
||||
|
||||
const { hasMissingNodes, missingNodePacks } = useMissingNodes()
|
||||
|
||||
// Should have missing nodes initially (2 missing since pack-3 is installed)
|
||||
expect(missingNodePacks.value).toHaveLength(2)
|
||||
expect(hasMissingNodes.value).toBe(true)
|
||||
|
||||
// Switch to empty workflow (simulates creating a new empty workflow)
|
||||
workflowPacksRef.value = []
|
||||
await nextTick()
|
||||
|
||||
// Should clear missing nodes
|
||||
expect(missingNodePacks.value).toHaveLength(0)
|
||||
expect(hasMissingNodes.value).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('missing core nodes detection', () => {
|
||||
|
||||
Reference in New Issue
Block a user