Skip to content

Commit 86b1e1a

Browse files
authored
Fix descriptions on core blueprints (#12220)
Core blueprints were storing the description under a different key than expected, which resulted in them displaying a placeholder description. When initializing the description for a subgraph, this alternative field is also checked. | Before | After | | ------ | ----- | | <img width="360" alt="before" src="https://github.com/user-attachments/assets/ed51c4a8-00cf-4927-9cba-880532a9e926" /> | <img width="360" alt="after" src="https://github.com/user-attachments/assets/f19bf80d-adcc-4e9b-a9ba-a5ac8e089e2d" />| Resolves FE-681 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-12220-Austin-blueprint-descriptions-35f6d73d3650812fa04df48c203bebd1) by [Unito](https://www.unito.io)
1 parent 4321013 commit 86b1e1a

6 files changed

Lines changed: 149 additions & 1 deletion

File tree

browser_tests/fixtures/components/SidebarTab.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export class NodeLibrarySidebarTabV2 extends SidebarTab {
9595
public readonly allTab: Locator
9696
public readonly blueprintsTab: Locator
9797
public readonly sortButton: Locator
98+
public readonly nodePreview: Locator
9899

99100
constructor(public override readonly page: Page) {
100101
super(page, 'node-library')
@@ -103,6 +104,7 @@ export class NodeLibrarySidebarTabV2 extends SidebarTab {
103104
this.allTab = this.getTab('All')
104105
this.blueprintsTab = this.getTab('Blueprints')
105106
this.sortButton = this.sidebarContent.getByRole('button', { name: 'Sort' })
107+
this.nodePreview = page.getByTestId(TestIds.sidebar.nodePreviewCard)
106108
}
107109

108110
getTab(name: string) {

browser_tests/fixtures/selectors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const TestIds = {
88
toolbar: 'side-toolbar',
99
nodeLibrary: 'node-library-tree',
1010
nodeLibrarySearch: 'node-library-search',
11+
nodePreviewCard: 'node-preview-card',
1112
workflows: 'workflows-sidebar',
1213
modeToggle: 'mode-toggle'
1314
},

browser_tests/tests/sidebar/nodeLibraryV2.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,13 @@ test.describe('Node library sidebar V2', () => {
120120
await expect(options.first()).toBeVisible()
121121
await expect.poll(() => options.count()).toBeGreaterThanOrEqual(2)
122122
})
123+
124+
test('Blueprint previews include description', async ({ comfyPage }) => {
125+
const tab = comfyPage.menu.nodeLibraryTabV2
126+
await tab.blueprintsTab.click()
127+
128+
await tab.getNode('test blueprint').hover()
129+
await expect(tab.nodePreview, 'Preview displays on hover').toBeVisible()
130+
await expect(tab.nodePreview).toContainText('Inverts the image')
131+
})
123132
})

src/components/node/NodePreviewCard.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div
33
class="flex flex-col overflow-hidden rounded-lg border border-border-default bg-base-background"
44
:style="{ width: `${BASE_WIDTH_PX * (scaleFactor / BASE_SCALE)}px` }"
5+
data-testid="node-preview-card"
56
>
67
<div ref="previewContainerRef" class="overflow-hidden p-3">
78
<div

src/stores/subgraphStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,9 @@ export const useSubgraphStore = defineStore('subgraph', () => {
289289
)
290290
const workflowExtra = workflow.initialState.extra
291291
const description =
292-
workflowExtra?.BlueprintDescription ?? 'User generated subgraph blueprint'
292+
workflowExtra?.BlueprintDescription ??
293+
workflow.initialState?.definitions?.subgraphs[0].description ??
294+
'User generated subgraph blueprint'
293295
const search_aliases = workflowExtra?.BlueprintSearchAliases
294296
const subgraphDefCategory =
295297
workflow.initialState.definitions?.subgraphs?.[0]?.category
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"revision": 0,
3+
"last_node_id": 2,
4+
"last_link_id": 0,
5+
"nodes": [
6+
{
7+
"id": 2,
8+
"type": "d0056772-3aca-4bc2-9971-8781df454c2b",
9+
"pos": [470.93671874999995, 461],
10+
"size": [225, 100],
11+
"flags": {},
12+
"order": 0,
13+
"mode": 0,
14+
"inputs": [
15+
{
16+
"name": "image",
17+
"type": "IMAGE",
18+
"link": null
19+
}
20+
],
21+
"outputs": [
22+
{
23+
"name": "IMAGE",
24+
"type": "IMAGE",
25+
"links": null
26+
}
27+
],
28+
"properties": {
29+
"proxyWidgets": []
30+
},
31+
"widgets_values": [],
32+
"title": "test blueprint"
33+
}
34+
],
35+
"links": [],
36+
"version": 0.4,
37+
"definitions": {
38+
"subgraphs": [
39+
{
40+
"id": "d0056772-3aca-4bc2-9971-8781df454c2b",
41+
"version": 1,
42+
"state": {
43+
"lastGroupId": 0,
44+
"lastNodeId": 2,
45+
"lastLinkId": 2,
46+
"lastRerouteId": 0
47+
},
48+
"revision": 0,
49+
"config": {},
50+
"name": "test blueprint",
51+
"inputNode": {
52+
"id": -10,
53+
"bounding": [240.43671874999995, 435, 128, 68]
54+
},
55+
"outputNode": {
56+
"id": -20,
57+
"bounding": [713.43671875, 435, 128, 68]
58+
},
59+
"inputs": [
60+
{
61+
"id": "d291ee9e-b1a6-4a9b-8163-ae7980ad312d",
62+
"name": "image",
63+
"type": "IMAGE",
64+
"linkIds": [1],
65+
"pos": [344.43671874999995, 459]
66+
}
67+
],
68+
"outputs": [
69+
{
70+
"id": "4836730c-14a8-487d-9009-594b7e745076",
71+
"name": "IMAGE",
72+
"type": "IMAGE",
73+
"linkIds": [2],
74+
"pos": [737.43671875, 459]
75+
}
76+
],
77+
"widgets": [],
78+
"nodes": [
79+
{
80+
"id": 1,
81+
"type": "ImageInvert",
82+
"pos": [428.43671874999995, 438],
83+
"size": [225, 72],
84+
"flags": {},
85+
"order": 0,
86+
"mode": 0,
87+
"inputs": [
88+
{
89+
"localized_name": "image",
90+
"name": "image",
91+
"type": "IMAGE",
92+
"link": 1
93+
}
94+
],
95+
"outputs": [
96+
{
97+
"localized_name": "IMAGE",
98+
"name": "IMAGE",
99+
"type": "IMAGE",
100+
"links": [2]
101+
}
102+
],
103+
"properties": {
104+
"Node name for S&R": "ImageInvert"
105+
}
106+
}
107+
],
108+
"groups": [],
109+
"links": [
110+
{
111+
"id": 1,
112+
"origin_id": -10,
113+
"origin_slot": 0,
114+
"target_id": 1,
115+
"target_slot": 0,
116+
"type": "IMAGE"
117+
},
118+
{
119+
"id": 2,
120+
"origin_id": 1,
121+
"origin_slot": 0,
122+
"target_id": -20,
123+
"target_slot": 0,
124+
"type": "IMAGE"
125+
}
126+
],
127+
"extra": {},
128+
"description": "Inverts the image"
129+
}
130+
]
131+
},
132+
"extra": {}
133+
}

0 commit comments

Comments
 (0)