diff --git a/src/core/graph/widgets/dynamicWidgets.test.ts b/src/core/graph/widgets/dynamicWidgets.test.ts index 2454553508b..7a6c07bd735 100644 --- a/src/core/graph/widgets/dynamicWidgets.test.ts +++ b/src/core/graph/widgets/dynamicWidgets.test.ts @@ -1,3 +1,4 @@ +import { fromAny } from '@total-typescript/shoehorn' import { afterEach, assert, @@ -16,11 +17,16 @@ import { liveAutogrowGroupOf } from '@/core/graph/widgets/dynamicWidgets' import { LGraph, LGraphNode, LiteGraph } from '@/lib/litegraph/src/litegraph' import { realignGroupWidgetChildLinks } from '@/lib/litegraph/src/linkDeduplication' import type { SerialisableGraph } from '@/lib/litegraph/src/types/serialisation' -import type { ComfyNodeDef as ComfyNodeDefV1 } from '@/schemas/nodeDefSchema' +import type { + ComfyNodeDef as ComfyNodeDefV1, + InputSpec +} from '@/schemas/nodeDefSchema' +import { app } from '@/scripts/app' import { useLitegraphService } from '@/services/litegraphService' import { useLinkStore } from '@/stores/linkStore' import { toLinkId } from '@/types/linkId' import { toNodeId } from '@/types/nodeId' +import type { NodeId } from '@/types/nodeId' const originalNamedValuesRestore = LiteGraph.namedValuesRestore afterEach(() => { @@ -958,3 +964,541 @@ describe('Autogrow followed by an ordinary combo child (FE-258)', () => { }).toEqual({ images: before, maskConnected: true }) }) }) + +const SEEDANCE_NODE_TYPE = 'test/SeedanceLikeReferences' +const IMAGE_GROUP_NAMES = 8 +const VIDEO_GROUP_NAMES = 4 + +/** + * Shaped after the Seedance partner nodes (PN-1520): two `IO.Autogrow` + * groups nested inside one `IO.DynamicCombo` option. + */ +function autogrowRefs( + type: string, + count: number, + min: number +): Required { + return [ + 'COMFY_AUTOGROW_V3', + { + template: { + input: { required: { ref: [type, {}] } }, + names: Array.from({ length: count }, (_, i) => `ref_${i + 1}`), + min + } + } + ] +} + +function seedanceNodeDef(min: number): ComfyNodeDefV1 { + const autogrow = (type: string, count: number) => + autogrowRefs(type, count, min) + return { + name: SEEDANCE_NODE_TYPE, + display_name: 'Seedance Like References', + category: 'testing', + python_module: 'nodes', + description: '', + input: { + required: { + model: [ + 'COMFY_DYNAMICCOMBO_V3', + { + options: [ + { + key: 'seedance-1-pro', + inputs: { + required: { + seed: ['INT', { default: 0 }], + reference_images: autogrow('IMAGE', IMAGE_GROUP_NAMES), + reference_videos: autogrow('VIDEO', VIDEO_GROUP_NAMES) + } + } + } + ] + } + ] + } + }, + output: ['VIDEO'], + output_name: ['VIDEO'], + output_node: false + } +} + +const SEEDANCE_MULTI_OPTION_TYPE = 'test/SeedanceLikeMultiOption' + +/** + * The Seedance shape with the reference groups on a model that is not the + * definition's first, as the customer's saved workflows have it. + */ +const seedanceMultiOptionDef: ComfyNodeDefV1 = { + name: SEEDANCE_MULTI_OPTION_TYPE, + display_name: 'Seedance Like Multi Option', + category: 'testing', + python_module: 'nodes', + description: '', + input: { + required: { + model: [ + 'COMFY_DYNAMICCOMBO_V3', + { + options: [ + { + key: 'seedance-1-lite', + inputs: { required: { seed: ['INT', { default: 0 }] } } + }, + { + key: 'seedance-1-pro', + inputs: { + required: { + seed: ['INT', { default: 0 }], + reference_images: autogrowRefs('IMAGE', IMAGE_GROUP_NAMES, 2), + reference_videos: autogrowRefs('VIDEO', VIDEO_GROUP_NAMES, 0) + } + } + } + ] + } + ] + } + }, + output: ['VIDEO'], + output_name: ['VIDEO'], + output_node: false +} + +class RefSourceNode extends LGraphNode { + constructor(title?: string) { + super(title ?? 'RefSource') + this.addOutput('image', 'IMAGE') + this.addOutput('video', 'VIDEO') + } +} + +const PREFIX_NODE_TYPE = 'test/PrefixNamedAutogrowInCombo' +const PREFIX_GROUP_MAX = 4 + +/** + * A nested autogrow group named by `prefix` rather than `names`, whose + * ordinals are therefore parsed back off the input name. + */ +const prefixNodeDef: ComfyNodeDefV1 = { + name: PREFIX_NODE_TYPE, + display_name: 'Prefix Named Autogrow In Combo', + category: 'testing', + python_module: 'nodes', + description: '', + input: { + required: { + model: [ + 'COMFY_DYNAMICCOMBO_V3', + { + options: [ + { + key: 'only', + inputs: { + required: { + seed: ['INT', { default: 0 }], + refs: [ + 'COMFY_AUTOGROW_V3', + { + template: { + input: { required: { ref: ['IMAGE', {}] } }, + prefix: 'ref', + min: 0, + max: PREFIX_GROUP_MAX + } + } + ] + } + } + } + ] + } + ] + } + }, + output: ['IMAGE'], + output_name: ['IMAGE'], + output_node: false +} + +function refNames(group: string, count: number): string[] { + return Array.from({ length: count }, (_, i) => `model.${group}.ref_${i + 1}`) +} + +/** + * Reloads `graph` into a fresh one the way a workflow tab switch does. + * `LGraph.configure` raises `app.configuringGraph` in the running app via an + * install the unit environment never performs, and autogrow's own connection + * handler branches on it, so a reload test that leaves it false exercises a + * path production never takes. + */ +function reloadWhileConfiguring(graph: LGraph, nodeId: NodeId): LGraphNode { + const reloaded = new LGraph() + const appInternals = fromAny<{ configuringGraphLevel: number }, unknown>(app) + appInternals.configuringGraphLevel = 1 + try { + reloaded.configure(structuredClone(graph.serialize())) + } finally { + appInternals.configuringGraphLevel = 0 + } + const reloadedNode = reloaded.getNodeById(nodeId) + assert.ok(reloadedNode, 'reloaded node') + return reloadedNode +} + +/** + * Samples once per generation across `generations` successive reloads, + * threading each reloaded graph into the next. Owns the reload lifecycle so a + * caller comparing a trajectory keeps a straight-line body. + */ +function sampleAcrossReloads( + graph: LGraph, + nodeId: NodeId, + generations: number, + sample: (node: LGraphNode, graph: LGraph) => T +): T[] { + const samples: T[] = [] + let currentGraph = graph + let currentNode = currentGraph.getNodeById(nodeId) + assert.ok(currentNode, 'sampled node') + for (let generation = 0; generation < generations; generation++) { + samples.push(sample(currentNode, currentGraph)) + currentNode = reloadWhileConfiguring(currentGraph, currentNode.id) + const reloadedGraph = currentNode.graph + assert.ok(reloadedGraph, 'reloaded graph') + currentGraph = reloadedGraph + } + return samples +} + +function hasFreeSlot(node: LGraphNode, prefix: string): boolean { + return node.inputs.some( + (input, slot) => input.name.startsWith(prefix) && !node.getInputLink(slot) + ) +} + +/** Names of `prefix` inputs on `node` that carry a link, in slot order. */ +function connectedUnder(node: LGraphNode, prefix: string): string[] { + return node.inputs.flatMap((input, slot) => + input.name.startsWith(prefix) && node.getInputLink(slot) ? [input.name] : [] + ) +} + +function connectRefs( + graph: LGraph, + node: LGraphNode, + group: string, + outputSlot: number, + count: number +) { + for (let i = 1; i <= count; i++) { + const name = `model.${group}.ref_${i}` + const slot = node.inputs.findIndex((input) => input.name === name) + assert.ok(slot !== -1, `slot for ${name}`) + const source = new RefSourceNode() + graph.add(source) + assert.ok(source.connect(outputSlot, node, slot), `connect ${name}`) + } +} + +describe('Nested autogrow links across a workflow reload (PN-1520, FE-2443)', () => { + beforeEach(() => { + LiteGraph.registerNodeType('test/RefSource', RefSourceNode) + }) + + // Pre-fix the rebuild regenerated a fixed `max(1, min + 1)` ordinals, so + // `min` alone decided how many links survived while the rest were deleted. + test.for([ + { min: 0, images: 5, videos: 2 }, + { min: 2, images: 6, videos: 2 }, + { min: 2, images: 5, videos: 2 }, + { min: 4, images: 8, videos: 4 }, + // A group whose sibling carries no links, or only one, is where a link + // saved past the definition's size lands on the sibling's slot. + { min: 0, images: 5, videos: 0 }, + { min: 0, images: 6, videos: 0 }, + { min: 1, images: 8, videos: 1 }, + { min: 2, images: 8, videos: 1 } + ])( + 'min=$min keeps all $images image and $videos video links', + async ({ min, images, videos }) => { + await useLitegraphService().registerNodeDef( + SEEDANCE_NODE_TYPE, + seedanceNodeDef(min) + ) + const graph = new LGraph() + const node = LiteGraph.createNode(SEEDANCE_NODE_TYPE) + assert.ok(node, 'seedance node') + graph.add(node) + connectRefs(graph, node, 'reference_images', 0, images) + connectRefs(graph, node, 'reference_videos', 1, videos) + + const reloadedNode = reloadWhileConfiguring(graph, node.id) + + expect({ + images: connectedUnder(reloadedNode, 'model.reference_images.'), + videos: connectedUnder(reloadedNode, 'model.reference_videos.'), + // A group that comes back with no free slot has nowhere to attach + // the next reference, so the layout is part of the contract. + imagesHaveSpare: hasFreeSlot(reloadedNode, 'model.reference_images.'), + videosHaveSpare: hasFreeSlot(reloadedNode, 'model.reference_videos.') + }).toEqual({ + images: refNames('reference_images', images), + videos: refNames('reference_videos', videos), + imagesHaveSpare: images < IMAGE_GROUP_NAMES, + videosHaveSpare: videos < VIDEO_GROUP_NAMES + }) + } + ) + + test('does not grow a group past the ordinals its names declare', async () => { + await useLitegraphService().registerNodeDef( + SEEDANCE_NODE_TYPE, + seedanceNodeDef(0) + ) + const graph = new LGraph() + const node = LiteGraph.createNode(SEEDANCE_NODE_TYPE) + assert.ok(node, 'seedance node') + graph.add(node) + connectRefs(graph, node, 'reference_videos', 1, VIDEO_GROUP_NAMES) + + const reloadedNode = reloadWhileConfiguring(graph, node.id) + + const videoSlots = reloadedNode.inputs.filter((input) => + input.name.startsWith('model.reference_videos.') + ) + expect({ + connected: connectedUnder(reloadedNode, 'model.reference_videos.').length, + slots: videoSlots.length + }).toEqual({ connected: 4, slots: 4 }) + }) + + test('does not accumulate slots over successive reloads', async () => { + await useLitegraphService().registerNodeDef( + SEEDANCE_NODE_TYPE, + seedanceNodeDef(0) + ) + const graph = new LGraph() + const node = LiteGraph.createNode(SEEDANCE_NODE_TYPE) + assert.ok(node, 'seedance node') + graph.add(node) + connectRefs(graph, node, 'reference_images', 0, 1) + connectRefs(graph, node, 'reference_videos', 1, 2) + + // Sizing a group from the slots its links ended up on compounds: a link + // filed onto the sibling group drags that group one ordinal longer every + // reload, without bound. + const trajectory = sampleAcrossReloads( + graph, + node.id, + 5, + (current, currentGraph) => ({ + imageSlots: current.inputs.filter((input) => + input.name.startsWith('model.reference_images.') + ).length, + links: currentGraph.links.size + }) + ) + + // Slots and links asserted together so the slot bound cannot be met by + // destroying a link instead. The drop to 2 links is the residual on this + // group's follow-up: links are sized for here but still placed by slot + // index, so one eventually lands where no name claims it. Closing that + // holds links at 3 throughout, and this expectation should be updated + // rather than the behaviour re-broken to match it. + expect(trajectory).toEqual([ + { imageSlots: 2, links: 3 }, + { imageSlots: 2, links: 3 }, + { imageSlots: 3, links: 3 }, + { imageSlots: 2, links: 2 }, + { imageSlots: 2, links: 2 } + ]) + }) + + test('keeps both groups when a saved non-default option is restored', async () => { + await useLitegraphService().registerNodeDef( + SEEDANCE_MULTI_OPTION_TYPE, + seedanceMultiOptionDef + ) + const graph = new LGraph() + const node = LiteGraph.createNode(SEEDANCE_MULTI_OPTION_TYPE) + assert.ok(node, 'seedance node') + graph.add(node) + const combo = node.widgets?.find((widget) => widget.name === 'model') + assert.ok(combo, 'model combo widget') + combo.value = 'seedance-1-pro' + connectRefs(graph, node, 'reference_images', 0, 6) + connectRefs(graph, node, 'reference_videos', 1, 2) + + // The production shape the table above cannot reach: the customer's + // saved model is not the definition's first option, so the restore is + // recognised only by `app.configuringGraph`. + const reloadedNode = reloadWhileConfiguring(graph, node.id) + expect({ + images: connectedUnder(reloadedNode, 'model.reference_images.'), + videos: connectedUnder(reloadedNode, 'model.reference_videos.') + }).toEqual({ + images: refNames('reference_images', 6), + videos: refNames('reference_videos', 2) + }) + }) + + // Vitest cannot interrupt the synchronous setter, so an unclamped bound + // surfaces as this budget expiring rather than as a failed assertion. + test( + 'ignores an out-of-range ordinal in a prefix-named group', + { timeout: 2_000 }, + async () => { + await useLitegraphService().registerNodeDef( + PREFIX_NODE_TYPE, + prefixNodeDef + ) + const graph = new LGraph() + const node = LiteGraph.createNode(PREFIX_NODE_TYPE) + assert.ok(node, 'prefix node') + graph.add(node) + const slot = node.inputs.findIndex( + (input) => input.name === 'model.refs.ref0' + ) + assert.ok(slot !== -1, 'prefix-named autogrow slot') + const source = new RefSourceNode() + graph.add(source) + assert.ok(source.connect(0, node, slot), 'connect model.refs.ref0') + + // The state a hand-edited workflow leaves behind: a linked input whose + // trailing digits parse to an ordinal far beyond the group's `max`. + // Re-applying the value must not walk up to it - every ordinal costs an + // iteration whether or not a slot results, so `ref900000000` would spin + // ~900M times and hang the tab even though no slot is ever added. + node.inputs[slot].name = 'model.refs.ref900000000' + + const combo = node.widgets?.find((widget) => widget.name === 'model') + assert.ok(combo, 'model combo widget') + combo.value = 'only' + + const refSlots = node.inputs.filter((input) => + input.name.startsWith('model.refs.') + ) + expect(refSlots.length).toBeLessThanOrEqual(PREFIX_GROUP_MAX) + } + ) +}) + +const SWITCHABLE_NODE_TYPE = 'test/SwitchableAutogrowOption' + +const switchableNodeDef: ComfyNodeDefV1 = { + name: SWITCHABLE_NODE_TYPE, + display_name: 'Switchable Autogrow Option', + category: 'testing', + python_module: 'nodes', + description: '', + input: { + required: { + model: [ + 'COMFY_DYNAMICCOMBO_V3', + { + options: [ + { + key: 'many-refs', + inputs: { + required: { + seed: ['INT', { default: 0 }], + reference_images: [ + 'COMFY_AUTOGROW_V3', + { + template: { + input: { required: { ref: ['IMAGE', {}] } }, + names: ['ref_1', 'ref_2', 'ref_3', 'ref_4'], + min: 0 + } + } + ] + } + } + }, + { + // Declares the same group, so regrowth is reachable on this + // option and the guard is what keeps the discarded links off it. + key: 'other-refs', + inputs: { + required: { + seed: ['INT', { default: 0 }], + reference_images: [ + 'COMFY_AUTOGROW_V3', + { + template: { + input: { required: { ref: ['IMAGE', {}] } }, + names: ['ref_1', 'ref_2', 'ref_3', 'ref_4'], + min: 0 + } + } + ] + } + } + } + ] + } + ] + } + }, + output: ['IMAGE'], + output_name: ['IMAGE'], + output_node: false +} + +describe('Autogrow regrowth is scoped to restoring a value', () => { + beforeEach(async () => { + LiteGraph.registerNodeType('test/RefSource', RefSourceNode) + await useLitegraphService().registerNodeDef( + SWITCHABLE_NODE_TYPE, + switchableNodeDef + ) + }) + + test('a user switching options discards its links instead of regrowing for them', () => { + const graph = new LGraph() + const node = LiteGraph.createNode(SWITCHABLE_NODE_TYPE) + assert.ok(node, 'switchable node') + graph.add(node) + connectRefs(graph, node, 'reference_images', 0, 3) + expect(connectedUnder(node, 'model.reference_images.')).toEqual( + refNames('reference_images', 3) + ) + + const combo = node.widgets?.find((widget) => widget.name === 'model') + assert.ok(combo, 'model combo widget') + combo.value = 'other-refs' + + // Only the ordinal the destination lays out on its own keeps its link; + // regrowing for the other two would be resurrecting discarded work. + expect(connectedUnder(node, 'model.reference_images.')).toEqual( + refNames('reference_images', 1) + ) + }) + + test('restores a saved non-default option while the graph is configuring', () => { + const graph = new LGraph() + const node = LiteGraph.createNode(SWITCHABLE_NODE_TYPE) + assert.ok(node, 'switchable node') + graph.add(node) + const combo = node.widgets?.find((widget) => widget.name === 'model') + assert.ok(combo, 'model combo widget') + combo.value = 'other-refs' + connectRefs(graph, node, 'reference_images', 0, 4) + expect(connectedUnder(node, 'model.reference_images.')).toEqual( + refNames('reference_images', 4) + ) + + // The saved option is not the one the node is constructed with, so + // `removedOption === value` is false here and only `app.configuringGraph` + // marks this as a restore. LGraph.configure sets it in the running app + // via an install the unit environment does not perform. + const reloadedNode = reloadWhileConfiguring(graph, node.id) + expect(connectedUnder(reloadedNode, 'model.reference_images.')).toEqual( + refNames('reference_images', 4) + ) + }) +}) diff --git a/src/core/graph/widgets/dynamicWidgets.ts b/src/core/graph/widgets/dynamicWidgets.ts index b37bbf073db..c5ad55d9b56 100644 --- a/src/core/graph/widgets/dynamicWidgets.ts +++ b/src/core/graph/widgets/dynamicWidgets.ts @@ -22,6 +22,7 @@ import { import { useLitegraphService } from '@/services/litegraphService' import { app } from '@/scripts/app' import type { ComfyApp } from '@/scripts/app' +import { serialisedLinkedInputsOf } from '@/lib/litegraph/src/linkDeduplication' import { captureInputLayout, replaceNodeInputs @@ -166,6 +167,21 @@ function dynamicComboWidget( const previous = captureInputLayout(node) const inputLinks = new Map(previous.links) const removedInputs = remove(node.inputs, isInGroup) + //Rebuilding regenerates a nested autogrow child at its static minimum, + //so re-applying a serialized value drops every link past it. Re-homing + //those needs the ordinals back; a user picking a different option is + //genuinely discarding them and must not resurrect any. + const restoring = app.configuringGraph || removedOption === value + //Prefer the serialized association: `configure` assigns links by slot + //index, so a link saved past the definition's size is sitting on a + //sibling group's input by now, and sizing either group from where the + //links landed grows one of them further every reload. + const retainedNames = !restoring + ? [] + : (serialisedLinkedInputsOf(node) ?? + removedInputs + .filter((input) => inputLinks.has(input)) + .map((input) => input.name)) for (const widget of remove(node.widgets, isInGroup)) { const optionValues = removedWidgetValues.get(removedOption) ?? new Map() optionValues.set(widget.name, { @@ -202,7 +218,9 @@ function dynamicComboWidget( isOptional: idx !== 0 }) specToAdd.display_name = key - addNodeInput(node, specToAdd) + if (specToAdd.type === 'COMFY_AUTOGROW_V3') + applyAutogrow(node, specToAdd, retainedNames) + else addNodeInput(node, specToAdd) } }) @@ -475,10 +493,10 @@ function addAutogrowGroup( groupName: string, node: AutogrowNode ) { - const { addNodeInput } = useLitegraphService() const { max, min, inputSpecs } = node.comfyDynamic.autogrow[groupName] if (ordinal >= max) return + const { addNodeInput } = useLitegraphService() const previous = captureInputLayout(node) const inputLinks = new Map(previous.links) const namedSpecs = inputSpecs.map((input) => ({ @@ -788,7 +806,37 @@ function withComfyAutogrow(node: LGraphNode): asserts node is AutogrowNode { } ) } -function applyAutogrow(node: LGraphNode, inputSpecV2: InputSpecV2) { +/** + * Highest ordinal of `groupName` named by `retainedNames`, or -1 for none. + * Membership resolves through the group's registration. That pins the result + * to a declared ordinal only when the group declares `names`; otherwise the + * ordinal is parsed off the name and the caller must clamp it. + */ +function highestRetainedOrdinal( + node: AutogrowNode, + groupName: string, + retainedNames: readonly string[] +): number { + let highest = -1 + for (const name of retainedNames) { + if (!name.startsWith(`${groupName}.`)) continue + const ordinal = resolveAutogrowOrdinal(name, groupName, node) + if (ordinal !== undefined && ordinal > highest) highest = ordinal + } + return highest +} + +/** + * @param retainedNames Linked input names the caller is about to re-home + * onto the rebuilt group. Grows far enough to define each, rather than + * stopping at `min` and leaving the rest to be dropped (PN-1520, FE-2443). + * Still bounded by `max`/`names`. + */ +function applyAutogrow( + node: LGraphNode, + inputSpecV2: InputSpecV2, + retainedNames: readonly string[] = [] +) { withComfyAutogrow(node) const parseResult = zAutogrowOptions.safeParse(inputSpecV2) @@ -805,13 +853,25 @@ function applyAutogrow(node: LGraphNode, inputSpecV2: InputSpecV2) { transformInputSpecV1ToV2(v, { name, isOptional: index === 1 }) ) ) + const groupMax = names?.length ?? max node.comfyDynamic.autogrow[inputSpecV2.name] = { names, min, - max: names?.length ?? max, + max: groupMax, prefix, inputSpecs: inputsV2 } - for (let i = 0; i === 0 || i < min + 1; i++) + //Without `names`, an ordinal is parsed off a serialized input name and so + //is unbounded. Clamp the loop, not just the slot: `addAutogrowGroup` + //refusing the ordinal still costs an iteration apiece, and a workflow + //naming `ref` would hang the tab. + const lastOrdinal = Math.min( + Math.max( + min, + highestRetainedOrdinal(node, inputSpecV2.name, retainedNames) + 1 + ), + groupMax - 1 + ) + for (let i = 0; i === 0 || i < lastOrdinal + 1; i++) addAutogrowGroup(i, inputSpecV2.name, node) } diff --git a/src/lib/litegraph/src/linkDeduplication.ts b/src/lib/litegraph/src/linkDeduplication.ts index be0359220f7..cf1f5019fb2 100644 --- a/src/lib/litegraph/src/linkDeduplication.ts +++ b/src/lib/litegraph/src/linkDeduplication.ts @@ -225,6 +225,34 @@ function isAutogrowGroupInput(node: LGraphNode, inputName: string): boolean { ) } +const serialisedLinkedInputNames = new WeakMap() + +/** + * Names of the inputs that carried a link in `nodeData`. + * + * `LGraphNode.configure` assigns links by slot index against a node built at + * its definition's size, so a link saved beyond that lands on whichever input + * now occupies its index - frequently a sibling group's. Anything that needs + * to know which group genuinely owned a link has to read it from the + * serialized data, because the slot it ended up on is not evidence. + */ +export function serialisedLinkedInputsOf( + node: LGraphNode +): readonly string[] | undefined { + return serialisedLinkedInputNames.get(node) +} + +function recordSerialisedLinkedInputs( + node: LGraphNode, + nodeData: Pick +): void { + const names = (nodeData.inputs ?? []).flatMap((input) => + input.link == null ? [] : [input.name] + ) + if (names.length) serialisedLinkedInputNames.set(node, names) + else serialisedLinkedInputNames.delete(node) +} + /** * Realigns a node's input links by name before its group widget values are * applied, for nodes that have a group widget child input. @@ -246,6 +274,8 @@ export function realignGroupWidgetChildLinks( node: LGraphNode, nodeData: Pick ): void { + recordSerialisedLinkedInputs(node, nodeData) + const { graph } = node if (!graph) return