@@ -47,6 +47,8 @@ function COMFY_DYNAMICCOMBO_V3(
4747
4848 const insertionPoint = node . widgets . findIndex ( ( w ) => w === widget ) + 1
4949 const startingLength = node . widgets . length
50+ const inputInsertionPoint =
51+ node . inputs . findIndex ( ( i ) => i . name === widget . name ) + 1
5052 const startingInputLength = node . inputs . length
5153 if ( insertionPoint === 0 )
5254 throw new Error ( "Dynamic widget doesn't exist on node" )
@@ -72,11 +74,24 @@ function COMFY_DYNAMICCOMBO_V3(
7274 for ( const addedWidget of addedWidgets ) {
7375 addedWidget . name = `${ widget . name } .${ addedWidget . name } `
7476 }
77+ node . widgets . splice ( insertionPoint , 0 , ...addedWidgets )
78+ node . size [ 1 ] = node . computeSize ( [ ...node . size ] ) [ 1 ]
7579 for ( const input of node . inputs . slice ( startingInputLength ) ) {
7680 input . name = `${ widget . name } .${ input . name } `
81+ if ( input . widget )
82+ input . widget . name = `${ widget . name } .${ input . widget . name } `
7783 }
78- node . widgets . splice ( insertionPoint , 0 , ...addedWidgets )
79- node . computeSize ( node . size )
84+ if ( inputInsertionPoint === 0 ) {
85+ if (
86+ addedWidgets . length === 0 &&
87+ node . inputs . length !== startingInputLength
88+ )
89+ //input is inputOnly, but lacks an insertion point
90+ throw new Error ( 'Failed to find input socket for ' + widget . name )
91+ return
92+ }
93+ const addedInputs = node . spliceInputs ( startingInputLength )
94+ node . spliceInputs ( inputInsertionPoint , 0 , ...addedInputs )
8095 }
8196 //A little hacky, but onConfigure won't work.
8297 //It fires too late and is overly disruptive
0 commit comments