Add reroute migration toast (#3286)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chenlei Hu
2025-03-30 21:48:10 -04:00
committed by GitHub
parent 7e76665a22
commit 58dec5ea42
15 changed files with 90 additions and 22 deletions

View File

@@ -47,7 +47,7 @@ import { ExtensionManager } from '@/types/extensionTypes'
import { ColorAdjustOptions, adjustColor } from '@/utils/colorUtil'
import { graphToPrompt } from '@/utils/executionUtil'
import { executeWidgetsCallback, isImageNode } from '@/utils/litegraphUtil'
import { migrateLegacyRerouteNodes } from '@/utils/migration/migrateReroute'
import { findLegacyRerouteNodes } from '@/utils/migration/migrateReroute'
import { deserialiseAndCreate } from '@/utils/vintageClipboard'
import { type ComfyApi, PromptExecutionError, api } from './api'
@@ -945,7 +945,11 @@ export class ComfyApp {
clean: boolean = true,
restore_view: boolean = true,
workflow: string | null | ComfyWorkflow = null,
{ showMissingNodesDialog = true, showMissingModelsDialog = true } = {}
{
showMissingNodesDialog = true,
showMissingModelsDialog = true,
checkForRerouteMigration = true
} = {}
) {
if (clean !== false) {
this.clean()
@@ -972,11 +976,16 @@ export class ComfyApp {
graphData = validatedGraphData ?? graphData
}
// Migrate legacy reroute nodes to the new format
if (graphData.version === 0.4) {
graphData = migrateLegacyRerouteNodes(graphData)
if (
checkForRerouteMigration &&
graphData.version === 0.4 &&
findLegacyRerouteNodes(graphData).length
) {
useToastStore().add({
group: 'reroute-migration',
severity: 'warn'
})
}
useWorkflowService().beforeLoadNewGraph()
const missingNodeTypes: MissingNodeType[] = []

View File

@@ -135,7 +135,8 @@ export class ChangeTracker {
try {
await this.app.loadGraphData(prevState, false, false, this.workflow, {
showMissingModelsDialog: false,
showMissingNodesDialog: false
showMissingNodesDialog: false,
checkForRerouteMigration: false
})
this.activeState = prevState
this.updateModified()