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:
Johnpaul Chiwetelu
2025-12-10 02:56:48 +01:00
parent 2903560416
commit 3230e600e6
2 changed files with 12 additions and 0 deletions

View File

@@ -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 {

View File

@@ -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) {