Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/extensions/core/widgetInputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,30 @@ describe('PrimitiveNode', () => {
expect(primitive.widgets?.[1].value).toBe('fixed')
})

it('limits combo value control to values matching the filter', () => {
const values = ['moss_a', 'beta', 'moss_b']
const graph = new LGraph()
const target = new LGraphNode('Target')
graph.add(target)
target.addInput('ckpt', 'COMBO')
target.inputs[0].widget = {
name: 'ckpt',
[GET_CONFIG]: () => [values, {}]
}
target.addWidget('combo', 'ckpt', 'moss_a', () => {}, { values })
const primitive = new PrimitiveNode('Primitive')
graph.add(primitive)
primitive.connect(0, target, 0)

const [value, control, filter] = primitive.widgets!
value.value = 'moss_a'
control.value = 'increment'
filter.value = 'moss'
control.afterQueued?.()

expect(value.value).toBe('moss_b')
})

it('does not apply a serialized value left over from an unresolved output type', () => {
const graph = new LGraph()
const target = new LGraphNode('Loader')
Expand Down
9 changes: 7 additions & 2 deletions src/extensions/core/widgetInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,13 @@ export class PrimitiveNode extends LGraphNode {
!inputData[1]?.control_after_generate &&
(widget.type === 'number' || widget.type === 'combo')
) {
addValueControlWidgets(this, widget, 'fixed', undefined, inputData)
if (this.widgets?.[1]) widget.linkedWidgets = [this.widgets[1]]
widget.linkedWidgets = addValueControlWidgets(
this,
widget,
'fixed',
undefined,
inputData
)
}

const controlValues = this.controlValues
Expand Down
Loading