Fix type on LoadClip being marked as asset (#6207)

Previously, asset conversion was performed on any combo widget on a
valid node. As the `type` widget on LoadClip was also a combo widget, it
was being incorrectly converted.

This PR changes the isAssetBrowserEligible check to also verify the
widget name is correct.
<img width="694" height="174" alt="image"
src="https://github.com/user-attachments/assets/a8523ade-7f59-4480-b5e6-8782fd680106"
/>


┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6207-Fix-type-on-LoadClip-being-marked-as-asset-2946d73d3650811690f8d3a221a5b76d)
by [Unito](https://www.unito.io)
This commit is contained in:
AustinMroz
2025-10-22 19:37:40 -07:00
committed by GitHub
parent e5a0466e40
commit f63d0f3289
6 changed files with 45 additions and 40 deletions

View File

@@ -288,7 +288,7 @@ describe('useModelToNodeStore', () => {
// Non-existent nodes are filtered out from registered types
const types = modelToNodeStore.getRegisteredNodeTypes()
expect(types.has('NonExistentLoader')).toBe(false)
expect(types['NonExistentLoader']).toBe(undefined)
expect(
modelToNodeStore.getCategoryForNodeType('NonExistentLoader')
@@ -347,13 +347,13 @@ describe('useModelToNodeStore', () => {
})
describe('getRegisteredNodeTypes', () => {
it('should return a Set instance', () => {
it('should return an object', () => {
const modelToNodeStore = useModelToNodeStore()
const result = modelToNodeStore.getRegisteredNodeTypes()
expect(result).toBeInstanceOf(Set)
expect(result).toBeTypeOf('object')
})
it('should return empty set when nodeDefStore is empty', () => {
it('should return empty Record when nodeDefStore is empty', () => {
// Create fresh Pinia for this test to avoid state persistence
setActivePinia(createPinia())
@@ -363,7 +363,7 @@ describe('useModelToNodeStore', () => {
const modelToNodeStore = useModelToNodeStore()
const result = modelToNodeStore.getRegisteredNodeTypes()
expect(result.size).toBe(0)
expect(result).toStrictEqual({})
// Restore original mock for subsequent tests
vi.mocked(useNodeDefStore, { partial: true }).mockReturnValue({
@@ -371,16 +371,15 @@ describe('useModelToNodeStore', () => {
})
})
it('should contain node types for efficient Set.has() lookups', () => {
it('should contain node types to resolve widget name', () => {
const modelToNodeStore = useModelToNodeStore()
modelToNodeStore.registerDefaults()
const result = modelToNodeStore.getRegisteredNodeTypes()
// Test Set.has() functionality which assetService depends on
expect(result.has('CheckpointLoaderSimple')).toBe(true)
expect(result.has('LoraLoader')).toBe(true)
expect(result.has('NonExistentNode')).toBe(false)
expect(result['CheckpointLoaderSimple']).toBe('ckpt_name')
expect(result['LoraLoader']).toBe('lora_name')
expect(result['NonExistentNode']).toBe(undefined)
})
})