mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 05:00:03 +00:00
[Reland] Restrict applyToGraph to PrimitiveNode (#2724)
This commit is contained in:
@@ -2,6 +2,7 @@ import type { LGraph } from '@comfyorg/litegraph'
|
||||
import { LGraphEventMode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { ComfyApiWorkflow, ComfyWorkflowJSON } from '@/types/comfyWorkflow'
|
||||
import { isPrimitiveNode } from '@/utils/typeGuardUtil'
|
||||
|
||||
/**
|
||||
* Converts the current graph workflow for sending to the API.
|
||||
@@ -17,8 +18,7 @@ export const graphToPrompt = async (
|
||||
for (const node of graph.computeExecutionOrder(false)) {
|
||||
const innerNodes = node.getInnerNodes ? node.getInnerNodes() : [node]
|
||||
for (const innerNode of innerNodes) {
|
||||
// Don't serialize frontend only nodes but let them make changes
|
||||
if (innerNode.isVirtualNode) {
|
||||
if (isPrimitiveNode(innerNode)) {
|
||||
innerNode.applyToGraph?.()
|
||||
}
|
||||
}
|
||||
|
||||
9
src/utils/typeGuardUtil.ts
Normal file
9
src/utils/typeGuardUtil.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { LGraphNode } from '@comfyorg/litegraph'
|
||||
|
||||
import type { PrimitiveNode } from '@/extensions/core/widgetInputs'
|
||||
|
||||
export function isPrimitiveNode(
|
||||
node: LGraphNode
|
||||
): node is PrimitiveNode & LGraphNode {
|
||||
return node.type === 'PrimitiveNode'
|
||||
}
|
||||
Reference in New Issue
Block a user