From df7c7383e21462a3c5543fc7202c306ab4ee8f72 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Thu, 3 Apr 2025 22:08:40 -0400 Subject: [PATCH] Only show reroute migration dialog when native reroute is not present (#3318) --- src/scripts/app.ts | 13 ++++++++++--- src/utils/migration/migrateReroute.ts | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index b17b932984..23c5a2b853 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -48,7 +48,10 @@ import { ExtensionManager } from '@/types/extensionTypes' import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil' import { graphToPrompt } from '@/utils/executionUtil' 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 { type ComfyApi, PromptExecutionError, api } from './api' @@ -986,11 +989,15 @@ export class ComfyApp { // Ideally we should not block users from loading the workflow. 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 ( checkForRerouteMigration && graphData.version === 0.4 && - findLegacyRerouteNodes(graphData).length + findLegacyRerouteNodes(graphData).length && + noNativeReroutes(graphData) ) { useToastStore().add({ group: 'reroute-migration', diff --git a/src/utils/migration/migrateReroute.ts b/src/utils/migration/migrateReroute.ts index 786ef9242f..c0a37cbc52 100644 --- a/src/utils/migration/migrateReroute.ts +++ b/src/utils/migration/migrateReroute.ts @@ -28,6 +28,15 @@ export function findLegacyRerouteNodes( ) 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 */