mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
Bugfix node widgets wrongly being prepared for qeueing on saving the workflow (#1331)
- calling graphToPrompt() invokes beforeQueued() which should not happen when saving the workflow
This commit is contained in:
@@ -1910,8 +1910,7 @@ export class ComfyApp {
|
|||||||
|
|
||||||
// Save current workflow automatically
|
// Save current workflow automatically
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const sortNodes = useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
|
const workflow = JSON.stringify(this.serializeGraph())
|
||||||
const workflow = JSON.stringify(this.graph.serialize({ sortNodes }))
|
|
||||||
localStorage.setItem('workflow', workflow)
|
localStorage.setItem('workflow', workflow)
|
||||||
if (api.clientId) {
|
if (api.clientId) {
|
||||||
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
|
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
|
||||||
@@ -2445,7 +2444,18 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the current graph workflow for sending to the API
|
* Serializes a graph using preferred user settings.
|
||||||
|
* @param graph The litegraph to serialize.
|
||||||
|
* @returns A serialized graph (aka workflow) with preferred user settings.
|
||||||
|
*/
|
||||||
|
serializeGraph(graph: LGraph = this.graph) {
|
||||||
|
const sortNodes = useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
|
||||||
|
return graph.serialize({ sortNodes })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the current graph workflow for sending to the API.
|
||||||
|
* Note: Node widgets are updated before serialization to prepare queueing.
|
||||||
* @returns The workflow and node links
|
* @returns The workflow and node links
|
||||||
*/
|
*/
|
||||||
async graphToPrompt(graph = this.graph, clean = true) {
|
async graphToPrompt(graph = this.graph, clean = true) {
|
||||||
@@ -2471,9 +2481,7 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortNodes = useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave')
|
const workflow = this.serializeGraph(graph)
|
||||||
|
|
||||||
const workflow = graph.serialize({ sortNodes })
|
|
||||||
const output = {}
|
const output = {}
|
||||||
// Process nodes in order of execution
|
// Process nodes in order of execution
|
||||||
for (const outerNode of graph.computeExecutionOrder(false)) {
|
for (const outerNode of graph.computeExecutionOrder(false)) {
|
||||||
|
|||||||
@@ -380,8 +380,8 @@ export class ComfyWorkflow {
|
|||||||
|
|
||||||
path = appendJsonExt(path)
|
path = appendJsonExt(path)
|
||||||
|
|
||||||
const p = await this.manager.app.graphToPrompt()
|
const workflow = this.manager.app.serializeGraph()
|
||||||
const json = JSON.stringify(p.workflow, null, 2)
|
const json = JSON.stringify(workflow, null, 2)
|
||||||
let resp = await api.storeUserData('workflows/' + path, json, {
|
let resp = await api.storeUserData('workflows/' + path, json, {
|
||||||
stringify: false,
|
stringify: false,
|
||||||
throwOnError: false,
|
throwOnError: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user