[Refactor] Update Litegraph widget types / cleanup (#3782)

This commit is contained in:
filtered
2025-05-06 19:40:30 +10:00
committed by GitHub
parent 6a3cf9e698
commit 0da6be5cdc
6 changed files with 20 additions and 6 deletions

View File

@@ -71,10 +71,12 @@ const addComboWidget = (node: LGraphNode, inputSpec: ComboInputSpec) => {
if (inputSpec.remote.refresh_button) remoteWidget.addRefreshButton()
const origOptions = widget.options
widget.options = new Proxy(origOptions as Record<string | symbol, any>, {
get(target, prop: string | symbol) {
if (prop !== 'values') return target[prop]
return remoteWidget.getValue()
widget.options = new Proxy(origOptions, {
get(target, prop) {
// Assertion: Proxy handler passthrough
return prop !== 'values'
? target[prop as keyof typeof target]
: remoteWidget.getValue()
}
})
}