Only show reroute migration dialog when native reroute is not present (#3318)

This commit is contained in:
Chenlei Hu
2025-04-03 22:08:40 -04:00
committed by GitHub
parent 1279f30f5a
commit df7c7383e2
2 changed files with 19 additions and 3 deletions

View File

@@ -48,7 +48,10 @@ import { ExtensionManager } from '@/types/extensionTypes'
import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil' import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil'
import { graphToPrompt } from '@/utils/executionUtil' import { graphToPrompt } from '@/utils/executionUtil'
import { executeWidgetsCallback, isImageNode } from '@/utils/litegraphUtil' import { executeWidgetsCallback, isImageNode } from '@/utils/litegraphUtil'
import { findLegacyRerouteNodes } from '@/utils/migration/migrateReroute' import {
findLegacyRerouteNodes,
noNativeReroutes
} from '@/utils/migration/migrateReroute'
import { deserialiseAndCreate } from '@/utils/vintageClipboard' import { deserialiseAndCreate } from '@/utils/vintageClipboard'
import { type ComfyApi, PromptExecutionError, api } from './api' import { type ComfyApi, PromptExecutionError, api } from './api'
@@ -986,11 +989,15 @@ export class ComfyApp {
// Ideally we should not block users from loading the workflow. // Ideally we should not block users from loading the workflow.
graphData = validatedGraphData ?? graphData graphData = validatedGraphData ?? graphData
} }
// Only show the reroute migration warning if the workflow does not have native
// reroutes. Merging reroute network has great complexity, and it is not supported
// for now.
// See: https://github.com/Comfy-Org/ComfyUI_frontend/issues/3317
if ( if (
checkForRerouteMigration && checkForRerouteMigration &&
graphData.version === 0.4 && graphData.version === 0.4 &&
findLegacyRerouteNodes(graphData).length findLegacyRerouteNodes(graphData).length &&
noNativeReroutes(graphData)
) { ) {
useToastStore().add({ useToastStore().add({
group: 'reroute-migration', group: 'reroute-migration',

View File

@@ -28,6 +28,15 @@ export function findLegacyRerouteNodes(
) as RerouteNode[] ) as RerouteNode[]
} }
/**
* Checks if the workflow has no native reroutes
*/
export function noNativeReroutes(workflow: WorkflowJSON04): boolean {
return (
!workflow.extra?.reroutes?.length && !workflow.extra?.linkExtensions?.length
)
}
/** /**
* Gets the center position of a node * Gets the center position of a node
*/ */