mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary Prune stale proxyWidgets entries that reference grandchild nodes no longer present in the outer subgraph after nested packing. ## Changes - **What**: Filter out proxyWidgets entries during hydration when the source node doesn't exist in the subgraph. Also skip missing-node entries in `_pruneStaleAliasFallbackEntries` as defense-in-depth. Write back cleaned entries so stale data doesn't persist. ## Review Focus The fix touches two codepaths in `SubgraphNode.ts`: 1. **Hydration** (`_internalConfigureAfterSlots`): Added `getNodeById` guard before accepting a proxyWidget entry, and broadened the write-back condition from legacy-only to any filtered entries. 2. **Runtime pruning** (`_pruneStaleAliasFallbackEntries`): Added early-exit for entries whose source node no longer exists — previously these survived because failed resolution returned `undefined` which bypassed the concrete-key comparison. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10390-fix-prune-stale-proxyWidgets-referencing-nodes-removed-by-nested-subgraph-packing-32b6d73d365081e69eedcb2b67d7043d) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '../fixtures/ComfyPage'
|
|
import { TestIds } from '../fixtures/selectors'
|
|
|
|
const WORKFLOW = 'subgraphs/nested-subgraph-stale-proxy-widgets'
|
|
|
|
/**
|
|
* Regression test for nested subgraph packing leaving stale proxyWidgets
|
|
* on the outer SubgraphNode.
|
|
*
|
|
* When two CLIPTextEncode nodes (ids 6, 7) inside the outer subgraph are
|
|
* packed into a nested subgraph (node 11), the outer SubgraphNode (id 10)
|
|
* must drop the now-stale ["7","text"] and ["6","text"] proxy entries.
|
|
* Only ["3","seed"] (KSampler) should remain.
|
|
*
|
|
* Stale entries render as "Disconnected" placeholder widgets (type "button").
|
|
*
|
|
* See: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10390
|
|
*/
|
|
test.describe(
|
|
'Nested subgraph stale proxyWidgets',
|
|
{ tag: ['@subgraph', '@widget'] },
|
|
() => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
})
|
|
|
|
test('Outer subgraph node has no stale proxyWidgets after nested packing', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(WORKFLOW)
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
|
|
const outerNode = comfyPage.vueNodes.getNodeLocator('10')
|
|
await expect(outerNode).toBeVisible()
|
|
|
|
const widgets = outerNode.getByTestId(TestIds.widgets.widget)
|
|
|
|
// Only the KSampler seed widget should be present — no stale
|
|
// "Disconnected" placeholders from the packed CLIPTextEncode nodes.
|
|
await expect(widgets).toHaveCount(1)
|
|
await expect(widgets.first()).toBeVisible()
|
|
|
|
// Verify the seed widget is present via its label
|
|
const seedWidget = outerNode.getByLabel('seed', { exact: true })
|
|
await expect(seedWidget).toBeVisible()
|
|
})
|
|
}
|
|
)
|