mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-22 07:19:41 +00:00
Subgraph widget promotion fixes (#5911)
- Fixes automatic promotion of image previews by ~~more correctly handling a usage of `requestAnimationFrame` and~~ introducing a means to perform actions upon successful load of preview. - When workflows contain an old proxyWidget property in string form, parse it instead of throwing an error. - Do not overlay the `label` of promoted widgets. Further consideration is needed, but this resolves the primary annoyance and prevents untranslated widget names See #5914 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5911-Subgraph-widget-promotion-fixes-2826d73d365081838ffeeea4b8d7068c) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -119,9 +119,15 @@ export function promoteRecommendedWidgets(subgraphNode: SubgraphNode) {
|
||||
const interiorNodes = subgraphNode.subgraph.nodes
|
||||
for (const node of interiorNodes) {
|
||||
node.updateComputedDisabled()
|
||||
//NOTE: Since this operation is async, previews still don't exist after the single frame
|
||||
//Add an onLoad callback to updatePreviews?
|
||||
updatePreviews(node)
|
||||
function checkWidgets() {
|
||||
updatePreviews(node)
|
||||
const widget = node.widgets?.find((w) => w.name.startsWith('$$'))
|
||||
if (!widget) return
|
||||
const pw = getProxyWidgets(subgraphNode)
|
||||
if (pw.some(matchesPropertyItem([node, widget]))) return
|
||||
promoteWidget(node, widget, [subgraphNode])
|
||||
}
|
||||
requestAnimationFrame(() => updatePreviews(node, checkWidgets))
|
||||
}
|
||||
const filteredWidgets: WidgetItem[] = interiorNodes
|
||||
.flatMap(nodeWidgets)
|
||||
|
||||
Reference in New Issue
Block a user