feature: isEnabled flag added & hardcoding deleted

This commit is contained in:
Jin Yi
2026-02-04 13:13:18 +09:00
parent 24612b2082
commit 1fc34dfd6a
3 changed files with 11 additions and 8 deletions

View File

@@ -236,5 +236,15 @@ describe('useNodeReplacementStore', () => {
expect(fetchNodeReplacements).toHaveBeenCalledOnce()
})
it('should not call API when setting is disabled', async () => {
vi.mocked(fetchNodeReplacements).mockResolvedValue(mockReplacements)
store = createStore(false)
await store.load()
expect(fetchNodeReplacements).not.toHaveBeenCalled()
expect(store.isLoaded).toBe(false)
})
})
})

View File

@@ -15,7 +15,7 @@ export const useNodeReplacementStore = defineStore('nodeReplacement', () => {
)
async function load() {
if (isLoaded.value) return
if (!isEnabled.value || isLoaded.value) return
try {
replacements.value = await fetchNodeReplacements()

View File

@@ -1137,13 +1137,6 @@ export class ComfyApp {
return
}
for (let n of nodes) {
// TODO: Remove hardcoded patches after node replacement API is implemented
// if (n.type == 'T2IAdapterLoader') n.type = 'ControlNetLoader'
// if (n.type == 'ConditioningAverage ') n.type = 'ConditioningAverage'
// if (n.type == 'SDV_img2vid_Conditioning') n.type = 'SVD_img2vid_Conditioning'
// if (n.type == 'Load3DAnimation') n.type = 'Load3D'
// if (n.type == 'Preview3DAnimation') n.type = 'Preview3D'
// Find missing node types
if (!(n.type in LiteGraph.registered_node_types)) {
const nodeReplacementStore = useNodeReplacementStore()