Skip to content

Commit 3ee9211

Browse files
fix: loader node widget value shows placeholder instead of filename on cloud (#7005)
Fixes issue on cloud where the Loader node dropdowns showed placeholder values (after refresh) in the widget UI despite a value being loaded. Cloud loader dropdowns hydrate via `useAssetWidgetData(nodeType)`, so `dropdownItems` stays empty until the Asset API returns friendly filenames. Meanwhile `modelValue` already holds the saved asset and the watcher only tracks `modelValue`: https://github.com/Comfy-Org/ComfyUI_frontend/blob/df653d6ce183fde7a67feb81c1a029143e521458/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue#L215-L226 This watcher runs before assets load, fails to find a match, clears `selectedSet`, and the placeholder persists: https://github.com/Comfy-Org/ComfyUI_frontend/blob/df653d6ce183fde7a67feb81c1a029143e521458/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue#L222-L224 Once the assets API resolves, `dropdownItems` recomputes but nothing resyncs because the watcher never sees that change. Desktop doesn’t hit this because it still reads from `widget.options.values` immediately. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7005-fix-loader-node-widget-value-shows-placeholder-instead-of-filename-on-cloud-2b86d73d36508125a16de5c9e366b014) by [Unito](https://www.unito.io)
1 parent f61bfe6 commit 3ee9211

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

cloud-loader-dropdown.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Fixes loader dropdown placeholder
2+
===============================
3+
4+
Cloud loader dropdowns hydrate via `useAssetWidgetData(nodeType)`, so `dropdownItems` stays empty until the Asset API returns friendly filenames. Meanwhile `modelValue` already holds the saved asset and the watcher at [WidgetSelectDropdown.vue#L215-L227](https://github.com/Comfy-Org/ComfyUI_frontend/blob/main/src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue#L215-L227) only tracks `modelValue`. It runs before assets load, fails to find a match, clears `selectedSet`, and the placeholder persists.
5+
6+
```ts
7+
watch(
8+
modelValue,
9+
(currentValue) => {
10+
if (currentValue === undefined) {
11+
selectedSet.value.clear()
12+
return
13+
}
14+
const item = dropdownItems.value.find((item) => item.name === currentValue)
15+
if (item) {
16+
selectedSet.value.clear()
17+
selectedSet.value.add(item.id)
18+
}
19+
},
20+
{ immediate: true }
21+
)
22+
```
23+
24+
Once the API resolves, `dropdownItems` recomputes but nothing resyncs because the watcher never sees that change. Desktop doesn’t hit this because it still reads from `widget.options.values` immediately.

src/renderer/extensions/vueNodes/widgets/components/WidgetSelectDropdown.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,13 @@ const acceptTypes = computed(() => {
213213
const layoutMode = ref<LayoutMode>(props.defaultLayoutMode ?? 'grid')
214214
215215
watch(
216-
modelValue,
217-
(currentValue) => {
216+
[modelValue, dropdownItems],
217+
([currentValue, _dropdownItems]) => {
218218
if (currentValue === undefined) {
219219
selectedSet.value.clear()
220220
return
221221
}
222+
222223
const item = dropdownItems.value.find((item) => item.name === currentValue)
223224
if (item) {
224225
selectedSet.value.clear()

0 commit comments

Comments
 (0)