mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 23:20:07 +00:00
fix: trigger widget callback when model is selected
Fixes model dropdown not properly updating when a model is selected from the model library or dropped onto canvas by calling the widget callback and forcing reactivity.
This commit is contained in:
@@ -150,6 +150,13 @@ const renderedRoot = computed<TreeExplorerNode<ModelOrFolder>>(() => {
|
||||
if (widget) {
|
||||
// @ts-expect-error fixme ts strict error
|
||||
widget.value = model.file_name
|
||||
if (model) {
|
||||
widget.callback?.(model!.file_name)
|
||||
// Force the reactive widgets array to update
|
||||
if (node.widgets) {
|
||||
node.widgets = [...node.widgets]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -73,6 +73,11 @@ export const useCanvasDrop = (canvasRef: Ref<HTMLCanvasElement | null>) => {
|
||||
)
|
||||
if (widget) {
|
||||
widget.value = model.file_name
|
||||
widget.callback?.(model.file_name)
|
||||
// Force the reactive widgets array to update
|
||||
if (targetGraphNode.widgets) {
|
||||
targetGraphNode.widgets = [...targetGraphNode.widgets]
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (node.data instanceof ComfyWorkflow) {
|
||||
|
||||
Reference in New Issue
Block a user