mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-13 17:10:06 +00:00
fix: display Blueprint badge instead of UUID for global subgraph blueprints (#9048)
## Problem The node search box badge displays long UUID strings (e.g., `comfyui-ltx-video-0fbc55c6-...`) for global/core blueprints, while user-created subgraphs correctly show "Blueprint" as the badge.  ## Root Cause In `loadGlobalBlueprint`, global blueprints set `python_module: v.info.node_pack` which contains UUID-like strings. The `getNodeSource()` function processes `python_module` to determine badge text, but UUID strings don't match any known pattern, resulting in ugly badge text. ## Solution - Change global blueprints to use `python_module: 'blueprint'` so they display "Blueprint" badge like user blueprints - Add `isGlobal` boolean flag to `ComfyNodeDef` schema to distinguish global from user blueprints - Update `isGlobalBlueprint()` to check the new `isGlobal` flag instead of `python_module !== 'blueprint'` ## Changes | File | Change | |------|--------| | `src/schemas/nodeDefSchema.ts` | Add optional `isGlobal?: boolean` field | | `src/stores/nodeDefStore.ts` | Add `isGlobal` field to `ComfyNodeDefImpl` class | | `src/stores/subgraphStore.ts` | Use `python_module: 'blueprint'` + `isGlobal: true` for global blueprints; update `isGlobalBlueprint()` check | ## Testing - [x] Existing unit tests pass - [x] TypeScript compiles without errors - [x] Lint passes Fixes COM-15168 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9048-fix-display-Blueprint-badge-instead-of-UUID-for-global-subgraph-blueprints-30e6d73d3650813cac27e02f8f2088df) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -177,6 +177,54 @@ describe('useSubgraphStore', () => {
|
||||
expect(store.isGlobalBlueprint('nonexistent')).toBe(false)
|
||||
})
|
||||
|
||||
describe('blueprint badge display', () => {
|
||||
it('should set isGlobal flag on global blueprints', async () => {
|
||||
await mockFetch(
|
||||
{},
|
||||
{
|
||||
global_bp: {
|
||||
name: 'Global Blueprint',
|
||||
info: { node_pack: 'some-uuid-string' },
|
||||
data: JSON.stringify(mockGraph)
|
||||
}
|
||||
}
|
||||
)
|
||||
const nodeDef = useNodeDefStore().nodeDefs.find(
|
||||
(d) => d.name === 'SubgraphBlueprint.global_bp'
|
||||
)
|
||||
expect(nodeDef).toBeDefined()
|
||||
expect(nodeDef?.isGlobal).toBe(true)
|
||||
})
|
||||
|
||||
it('should not set isGlobal flag on user blueprints', async () => {
|
||||
await mockFetch({ 'user-blueprint.json': mockGraph })
|
||||
const nodeDef = useNodeDefStore().nodeDefs.find(
|
||||
(d) => d.name === 'SubgraphBlueprint.user-blueprint'
|
||||
)
|
||||
expect(nodeDef).toBeDefined()
|
||||
expect(nodeDef?.isGlobal).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should use blueprint python_module for global blueprints to show Blueprint badge', async () => {
|
||||
await mockFetch(
|
||||
{},
|
||||
{
|
||||
global_bp: {
|
||||
name: 'Global Blueprint',
|
||||
info: { node_pack: 'comfyui-ltx-video-0fbc55c6-long-uuid' },
|
||||
data: JSON.stringify(mockGraph)
|
||||
}
|
||||
}
|
||||
)
|
||||
const nodeDef = useNodeDefStore().nodeDefs.find(
|
||||
(d) => d.name === 'SubgraphBlueprint.global_bp'
|
||||
)
|
||||
expect(nodeDef).toBeDefined()
|
||||
expect(nodeDef?.python_module).toBe('blueprint')
|
||||
expect(nodeDef?.nodeSource.displayText).toBe('Blueprint')
|
||||
})
|
||||
})
|
||||
|
||||
describe('search_aliases support', () => {
|
||||
it('should include search_aliases from workflow extra', async () => {
|
||||
const mockGraphWithAliases = {
|
||||
|
||||
Reference in New Issue
Block a user