Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Sep 5, 2024
1 parent 189ee93 commit 1f49659
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
12 changes: 3 additions & 9 deletions src/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
LiteGraph
} from '@comfyorg/litegraph'
import { StorageLocation } from '@/types/settingTypes'
import { LoadGraphDataOptions } from '@/types/comfy'

// CSS imports. style.css must be imported later as it overwrites some litegraph styles.
import '@comfyorg/litegraph/style.css'
Expand Down Expand Up @@ -2208,13 +2207,8 @@ export class ComfyApp {
clean: boolean = true,
restore_view: boolean = true,
workflow: string | null | ComfyWorkflow = null,
options: Partial<LoadGraphDataOptions> = {}
{ showMissingNodesDialog = false, showMissingModelsDialog = false } = {}
) {
const finalOptions: LoadGraphDataOptions = _.defaults(options, {
showMissingNodesDialog: true,
showMissingModelsDialog: true
})

if (clean !== false) {
this.clean()
}
Expand Down Expand Up @@ -2405,10 +2399,10 @@ export class ComfyApp {
}

// TODO: Properly handle if both nodes and models are missing (sequential dialogs?)
if (missingNodeTypes.length && finalOptions.showMissingNodesDialog) {
if (missingNodeTypes.length && showMissingNodesDialog) {
this.showMissingNodesError(missingNodeTypes)
}
if (missingModels.length && finalOptions.showMissingModelsDialog) {
if (missingModels.length && showMissingModelsDialog) {
this.showMissingModelsError(missingModels)
}
await this.#invokeExtensionsAsync('afterConfigureGraph', missingNodeTypes)
Expand Down
5 changes: 1 addition & 4 deletions src/scripts/changeTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ export class ChangeTracker {
if (prevState) {
target.push(this.activeState)
this.isOurLoad = true
await this.app.loadGraphData(prevState, false, false, this.workflow, {
showMissingModelsDialog: false,
showMissingNodesDialog: false
})
await this.app.loadGraphData(prevState, false, false, this.workflow)
this.activeState = prevState
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/scripts/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,7 @@ export class ComfyWorkflow {
this.changeTracker.activeState,
true,
true,
this,
{
showMissingNodesDialog: false,
showMissingModelsDialog: false
}
this
)
} else {
const data = await this.getWorkflowData()
Expand Down
16 changes: 0 additions & 16 deletions src/types/comfy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,3 @@ export type ComfyObjectInfo = {
}

export type ComfyObjectInfoConfig = [string | any[]] | [string | any[], any]

/**
* Defines the options for loading a graph state
*/
export interface LoadGraphDataOptions {
/**
* Whether to display a dialog if missing nodes are detected
* @default true
*/
showMissingNodesDialog: boolean
/**
* Whether to display a dialog if missing models are detected
* @default true
*/
showMissingModelsDialog: boolean
}

0 comments on commit 1f49659

Please sign in to comment.