Skip to content
Closed
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
7 changes: 7 additions & 0 deletions src/components/sidebar/tabs/ModelLibrarySidebarTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Comment on lines +155 to +158
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this part won't be necessary after #7095?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm having second thoughts about it

}
Comment on lines 151 to +159
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Model click now triggers widget callback and reactivity; consider minor TS cleanup

The new block that calls widget.callback?.(model!.file_name) and then clones node.widgets correctly mirrors the canvas‑drop behavior and should fix the missing update when selecting a model from the sidebar.

Two small follow‑ups you might consider here:

  • Inside if (model) { ... }, the non‑null assertion is redundant; widget.callback?.(model.file_name) is sufficient and clearer on Line [154].
  • This region still relies on multiple @ts-expect-error annotations (Lines [142], [147], [151]). To align with the guideline of avoiding @ts-expect-error, it would be good in a follow‑up to tighten the typings for model, node, and widgets so those suppressions can be removed.

Functionally this change looks good; these are purely refactoring/clean‑up suggestions.

🤖 Prompt for AI Agents
In src/components/sidebar/tabs/ModelLibrarySidebarTab.vue around lines 151 to
159, remove the redundant non‑null assertion by changing
widget.callback?.(model!.file_name) to widget.callback?.(model.file_name), and
in a follow‑up tighten the TypeScript types for model, node, widgets and
widget.callback (e.g., ensure model is typed non‑nullable when inside the if
(model) block, node.widgets is typed as an array, and widget.callback has the
correct signature) so the @ts-expect-error comments on lines ~142, ~147 and ~151
can be removed; ensure after adjusting types you still clone node.widgets
(node.widgets = [...node.widgets]) to trigger reactivity.

}
}
} else {
Expand Down
5 changes: 5 additions & 0 deletions src/composables/useCanvasDrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading