mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-24 00:34:09 +00:00
[backport cloud/1.32] fix: don't use registry when only checking for presence of missing nodes (#6971)
## Summary
Backport of #6965 onto cloud/1.32.
- cherry-picked 83f04490b
- resolved merge conflict in
src/components/actionbar/ComfyRunButton/ComfyQueueButton.vue to keep
cloud queue controls while wiring in graphHasMissingNodes
## Testing
- pnpm typecheck
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6971-backport-cloud-1-32-fix-don-t-use-registry-when-only-checking-for-presence-of-missing--2b86d73d365081029489c10d57f960f6)
by [Unito](https://www.unito.io)
This commit is contained in:
@@ -78,13 +78,15 @@ import { useI18n } from 'vue-i18n'
|
||||
|
||||
import { isCloud } from '@/platform/distribution/types'
|
||||
import { useTelemetry } from '@/platform/telemetry'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import {
|
||||
useQueuePendingTaskCountStore,
|
||||
useQueueSettingsStore
|
||||
} from '@/stores/queueStore'
|
||||
import { useWorkspaceStore } from '@/stores/workspaceStore'
|
||||
import { useMissingNodes } from '@/workbench/extensions/manager/composables/nodePack/useMissingNodes'
|
||||
import { graphHasMissingNodes } from '@/workbench/extensions/manager/utils/graphHasMissingNodes'
|
||||
|
||||
import BatchCountEdit from '../BatchCountEdit.vue'
|
||||
|
||||
@@ -92,7 +94,10 @@ const workspaceStore = useWorkspaceStore()
|
||||
const queueCountStore = storeToRefs(useQueuePendingTaskCountStore())
|
||||
const { mode: queueMode, batchCount } = storeToRefs(useQueueSettingsStore())
|
||||
|
||||
const { hasMissingNodes } = useMissingNodes()
|
||||
const nodeDefStore = useNodeDefStore()
|
||||
const hasMissingNodes = computed(() =>
|
||||
graphHasMissingNodes(app.graph, nodeDefStore.nodeDefsByName)
|
||||
)
|
||||
|
||||
const { t } = useI18n()
|
||||
const queueModeMenuItemLookup = computed(() => {
|
||||
|
||||
@@ -64,11 +64,13 @@ import {
|
||||
ComfyWorkflow,
|
||||
useWorkflowStore
|
||||
} from '@/platform/workflow/management/stores/workflowStore'
|
||||
import { app } from '@/scripts/app'
|
||||
import { useDialogService } from '@/services/dialogService'
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import { useNodeDefStore } from '@/stores/nodeDefStore'
|
||||
import { useSubgraphNavigationStore } from '@/stores/subgraphNavigationStore'
|
||||
import { appendJsonExt } from '@/utils/formatUtil'
|
||||
import { useMissingNodes } from '@/workbench/extensions/manager/composables/nodePack/useMissingNodes'
|
||||
import { graphHasMissingNodes } from '@/workbench/extensions/manager/utils/graphHasMissingNodes'
|
||||
|
||||
interface Props {
|
||||
item: MenuItem
|
||||
@@ -79,7 +81,10 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
isActive: false
|
||||
})
|
||||
|
||||
const { hasMissingNodes } = useMissingNodes()
|
||||
const nodeDefStore = useNodeDefStore()
|
||||
const hasMissingNodes = computed(() =>
|
||||
graphHasMissingNodes(app.graph, nodeDefStore.nodeDefsByName)
|
||||
)
|
||||
|
||||
const { t } = useI18n()
|
||||
const menu = ref<InstanceType<typeof Menu> & MenuState>()
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import { unref } from 'vue'
|
||||
import type { MaybeRef } from 'vue'
|
||||
|
||||
import type {
|
||||
LGraph,
|
||||
LGraphNode,
|
||||
Subgraph
|
||||
} from '@/lib/litegraph/src/litegraph'
|
||||
import type { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
|
||||
import { collectAllNodes } from '@/utils/graphTraversalUtil'
|
||||
|
||||
export type NodeDefLookup = Record<string, ComfyNodeDefImpl | undefined>
|
||||
|
||||
const isNodeMissingDefinition = (
|
||||
node: LGraphNode,
|
||||
nodeDefsByName: NodeDefLookup
|
||||
) => {
|
||||
const nodeName = node?.type
|
||||
if (!nodeName) return false
|
||||
return !nodeDefsByName[nodeName]
|
||||
}
|
||||
|
||||
export const collectMissingNodes = (
|
||||
graph: LGraph | Subgraph | null | undefined,
|
||||
nodeDefsByName: MaybeRef<NodeDefLookup>
|
||||
): LGraphNode[] => {
|
||||
if (!graph) return []
|
||||
const lookup = unref(nodeDefsByName)
|
||||
return collectAllNodes(graph, (node) => isNodeMissingDefinition(node, lookup))
|
||||
}
|
||||
|
||||
export const graphHasMissingNodes = (
|
||||
graph: LGraph | Subgraph | null | undefined,
|
||||
nodeDefsByName: MaybeRef<NodeDefLookup>
|
||||
) => {
|
||||
return collectMissingNodes(graph, nodeDefsByName).length > 0
|
||||
}
|
||||
Reference in New Issue
Block a user