Fix not clamping combo index when values are updated
This commit is contained in:
@@ -59,8 +59,15 @@ export default class ComfyComboNode extends ComfyWidgetNode<string> {
|
|||||||
if (values == null)
|
if (values == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const changed = this.properties.values != values;
|
let changed = this.properties.values != values;
|
||||||
this.properties.values = values;
|
this.properties.values = values;
|
||||||
|
|
||||||
|
const oldValue = get(this.value)
|
||||||
|
if (this.properties.values.indexOf(oldValue) === -1) {
|
||||||
|
changed = true;
|
||||||
|
this.value.set(this.properties.values[0])
|
||||||
|
}
|
||||||
|
|
||||||
if (lightUp && get(this.firstLoad) && changed)
|
if (lightUp && get(this.firstLoad) && changed)
|
||||||
this.lightUp.set(true)
|
this.lightUp.set(true)
|
||||||
|
|
||||||
@@ -116,11 +123,14 @@ export default class ComfyComboNode extends ComfyWidgetNode<string> {
|
|||||||
console.warn("CHECK COMBO CONNECTION", otherProps, thisProps)
|
console.warn("CHECK COMBO CONNECTION", otherProps, thisProps)
|
||||||
|
|
||||||
// Ensure combo options match
|
// Ensure combo options match
|
||||||
if (!(otherProps.values instanceof Array))
|
if (!(otherProps.values instanceof Array) || otherProps.values.length === 0)
|
||||||
return false;
|
|
||||||
if (thisProps.values.find((v, i) => otherProps.values.indexOf(v) === -1))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
thisProps.values = Array.from(otherProps.values);
|
||||||
|
const value = get(this.value)
|
||||||
|
if (thisProps.values.indexOf(value) === -1)
|
||||||
|
this.setValue(thisProps.values[0])
|
||||||
|
|
||||||
console.warn("PASSED")
|
console.warn("PASSED")
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user