Skip to content

Commit c76b8c3

Browse files
committed
Add optional indicator to auto-grow
1 parent a977d74 commit c76b8c3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/core/graph/widgets/dynamicWidgets.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function intersection(...sets: string[][]): string[] {
230230
.map(([key]) => key)
231231
}
232232

233-
export function applyMatchType(node: LGraphNode, inputSpec: InputSpecV2) {
233+
function applyMatchType(node: LGraphNode, inputSpec: InputSpecV2) {
234234
const { addNodeInput } = useLitegraphService()
235235
const name = inputSpec.name
236236
const { allowed_types, template_id } = (
@@ -327,7 +327,9 @@ export function applyMatchType(node: LGraphNode, inputSpec: InputSpecV2) {
327327

328328
export function applyAutoGrow(node: LGraphNode, inputSpec: InputSpecV2) {
329329
const { addNodeInput } = useLitegraphService()
330-
//@ts-expect-error - implement min, define inputSpec
330+
//TODO: reconsider min. Inputs aren't eagerly created,
331+
//but are indicated as non-optional once created
332+
//@ts-expect-error - define inputSpec
331333
const { input, min, names, prefix, max } = inputSpec.template
332334
const inputTypes: [Record<string, InputSpec> | undefined, boolean][] = [
333335
[input.required, false],
@@ -357,7 +359,8 @@ export function applyAutoGrow(node: LGraphNode, inputSpec: InputSpecV2) {
357359
for (const input of inputsV2) {
358360
const namedSpec = {
359361
...input,
360-
name: names ? names[ordinal] : prefix + ordinal
362+
name: names ? names[ordinal] : prefix + ordinal,
363+
isOptional: ordinal > (min ?? 0)
361364
}
362365
addNodeInput(node, namedSpec)
363366
const addedInput = node.spliceInputs(node.inputs.length - 1, 1)[0]
@@ -461,4 +464,3 @@ export function applyAutoGrow(node: LGraphNode, inputSpec: InputSpecV2) {
461464
}
462465
)
463466
}
464-
//COMFY_AUTOGROW_V3

0 commit comments

Comments
 (0)