mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-30 12:59:55 +00:00
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`:df653d6ce1/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:df653d6ce1/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)
25 lines
1.1 KiB
Markdown
25 lines
1.1 KiB
Markdown
Fixes loader dropdown placeholder
|
||
===============================
|
||
|
||
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.
|
||
|
||
```ts
|
||
watch(
|
||
modelValue,
|
||
(currentValue) => {
|
||
if (currentValue === undefined) {
|
||
selectedSet.value.clear()
|
||
return
|
||
}
|
||
const item = dropdownItems.value.find((item) => item.name === currentValue)
|
||
if (item) {
|
||
selectedSet.value.clear()
|
||
selectedSet.value.add(item.id)
|
||
}
|
||
},
|
||
{ immediate: true }
|
||
)
|
||
```
|
||
|
||
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.
|