Skip to content

Commit 8d818f5

Browse files
christian-byrnearjansingh
authored andcommitted
fix Vue node widgets should be in disabled state if their slots are connected with a link (#5834)
## Summary Fixes #5692 by making widget link connection status trigger on change so Vue widgets with connected links could properly switch to the `disabled` state when they are implicitly converted to inputs. ## Changes - **What**: Added `node:slot-links:changed` event tracking and reactive slot data synchronization for Vue widgets ```mermaid graph TD A[Widget Link Change] --> B[NodeInputSlot.link setter] B --> C{Is Widget Input?} C -->|Yes| D[Trigger slot-links:changed] C -->|No| E[End] D --> F[Graph Event Handler] F --> G[syncNodeSlotData] G --> H[Update Vue Reactive Data] H --> I[Widget Re-render] style A fill:#f9f9f9,stroke:#333,color:#000 style I fill:#f9f9f9,stroke:#333,color:#000 ``` ## Review Focus Widget reactivity performance with frequent link changes and event handler memory management in graph operations. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5834-fix-Vue-node-widgets-should-be-in-disabled-state-if-their-slots-are-connected-with-a-link-27c6d73d365081f6a6c3c1ddc3905c5e) by [Unito](https://www.unito.io)
1 parent 5d564ef commit 8d818f5

File tree

12 files changed

+388
-82
lines changed

12 files changed

+388
-82
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"id": "95ea19ba-456c-46e8-aa40-dc3ff135b746",
3+
"revision": 0,
4+
"last_node_id": 11,
5+
"last_link_id": 10,
6+
"nodes": [
7+
{
8+
"id": 10,
9+
"type": "KSampler",
10+
"pos": [494.3333740234375, 142.3333282470703],
11+
"size": [444, 399],
12+
"flags": {},
13+
"order": 1,
14+
"mode": 0,
15+
"inputs": [
16+
{
17+
"name": "model",
18+
"type": "MODEL",
19+
"link": null
20+
},
21+
{
22+
"name": "positive",
23+
"type": "CONDITIONING",
24+
"link": null
25+
},
26+
{
27+
"name": "negative",
28+
"type": "CONDITIONING",
29+
"link": null
30+
},
31+
{
32+
"name": "latent_image",
33+
"type": "LATENT",
34+
"link": null
35+
},
36+
{
37+
"name": "seed",
38+
"type": "INT",
39+
"widget": {
40+
"name": "seed"
41+
},
42+
"link": 10
43+
}
44+
],
45+
"outputs": [
46+
{
47+
"name": "LATENT",
48+
"type": "LATENT",
49+
"links": null
50+
}
51+
],
52+
"properties": {
53+
"Node name for S&R": "KSampler"
54+
},
55+
"widgets_values": [67, "randomize", 20, 8, "euler", "simple", 1]
56+
},
57+
{
58+
"id": 11,
59+
"type": "PrimitiveInt",
60+
"pos": [24.333343505859375, 149.6666717529297],
61+
"size": [444, 125],
62+
"flags": {},
63+
"order": 0,
64+
"mode": 0,
65+
"inputs": [],
66+
"outputs": [
67+
{
68+
"name": "INT",
69+
"type": "INT",
70+
"links": [10]
71+
}
72+
],
73+
"properties": {
74+
"Node name for S&R": "PrimitiveInt"
75+
},
76+
"widgets_values": [67, "randomize"]
77+
}
78+
],
79+
"links": [[10, 11, 0, 10, 4, "INT"]],
80+
"groups": [],
81+
"config": {},
82+
"extra": {
83+
"ds": {
84+
"scale": 1,
85+
"offset": [0, 0]
86+
},
87+
"frontendVersion": "1.28.6"
88+
},
89+
"version": 0.4
90+
}

browser_tests/fixtures/VueNodeHelpers.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,24 @@ export class VueNodeHelpers {
119119
await this.page.waitForSelector('[data-node-id]')
120120
}
121121
}
122+
123+
/**
124+
* Get a specific widget by node title and widget name
125+
*/
126+
getWidgetByName(nodeTitle: string, widgetName: string): Locator {
127+
return this.getNodeByTitle(nodeTitle).locator(
128+
`_vue=[widget.name="${widgetName}"]`
129+
)
130+
}
131+
132+
/**
133+
* Get controls for input number widgets (increment/decrement buttons and input)
134+
*/
135+
getInputNumberControls(widget: Locator) {
136+
return {
137+
input: widget.locator('input'),
138+
incrementButton: widget.locator('button').first(),
139+
decrementButton: widget.locator('button').last()
140+
}
141+
}
122142
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {
2+
comfyExpect as expect,
3+
comfyPageFixture as test
4+
} from '../../../../fixtures/ComfyPage'
5+
6+
test.describe('Vue Integer Widget', () => {
7+
test.beforeEach(async ({ comfyPage }) => {
8+
await comfyPage.setSetting('Comfy.VueNodes.Enabled', true)
9+
await comfyPage.setup()
10+
})
11+
12+
test('should be disabled and not allow changing value when link connected to slot', async ({
13+
comfyPage
14+
}) => {
15+
await comfyPage.loadWorkflow('vueNodes/linked-int-widget')
16+
await comfyPage.vueNodes.waitForNodes()
17+
18+
const seedWidget = comfyPage.vueNodes.getWidgetByName('KSampler', 'seed')
19+
const controls = comfyPage.vueNodes.getInputNumberControls(seedWidget)
20+
const initialValue = Number(await controls.input.inputValue())
21+
22+
// Verify widget is disabled when linked
23+
await controls.incrementButton.click({ force: true })
24+
await expect(controls.input).toHaveValue(initialValue.toString())
25+
26+
await controls.decrementButton.click({ force: true })
27+
await expect(controls.input).toHaveValue(initialValue.toString())
28+
29+
await expect(seedWidget).toBeVisible()
30+
31+
// Delete the node that is linked to the slot (freeing up the widget)
32+
await comfyPage.vueNodes.getNodeByTitle('Int').click()
33+
await comfyPage.vueNodes.deleteSelected()
34+
35+
// Test widget works when unlinked
36+
await controls.incrementButton.click()
37+
await expect(controls.input).toHaveValue((initialValue + 1).toString())
38+
39+
await controls.decrementButton.click()
40+
await expect(controls.input).toHaveValue(initialValue.toString())
41+
})
42+
})

0 commit comments

Comments
 (0)